launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23137
[Merge] lp:~cjwatson/launchpad/close-account-unactivated into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/close-account-unactivated into lp:launchpad.
Commit message:
Allow closing unactivated accounts.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/close-account-unactivated/+merge/360084
Unactivated accounts contain personal data, albeit only a small amount, so it's conceivable that we might be required to close them. (Indeed, we've had a GDPR erasure request that will probably turn out to require this.)
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/close-account-unactivated into lp:launchpad.
=== modified file 'lib/lp/registry/scripts/tests/test_closeaccount.py'
--- lib/lp/registry/scripts/tests/test_closeaccount.py 2018-12-04 13:00:56 +0000
+++ lib/lp/registry/scripts/tests/test_closeaccount.py 2018-12-04 17:56:17 +0000
@@ -180,6 +180,16 @@
self.assertRemoved(account_ids[1], person_ids[1])
self.assertNotRemoved(account_ids[2], person_ids[2])
+ def test_unactivated(self):
+ person = self.factory.makePerson(
+ account_status=AccountStatus.NOACCOUNT)
+ person_id = person.id
+ account_id = person.account.id
+ script = self.makeScript([person.guessedemails[0].email])
+ with dbuser('launchpad'):
+ self.runScript(script)
+ self.assertRemoved(account_id, person_id)
+
def test_retains_audit_trail(self):
person = self.factory.makePerson()
person_id = person.id
=== modified file 'lib/lp/services/identity/interfaces/account.py'
--- lib/lp/services/identity/interfaces/account.py 2018-11-29 18:25:03 +0000
+++ lib/lp/services/identity/interfaces/account.py 2018-12-04 17:56:17 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Account interfaces."""
@@ -243,7 +243,7 @@
transitions = {
AccountStatus.PLACEHOLDER: [
AccountStatus.NOACCOUNT, AccountStatus.ACTIVE],
- AccountStatus.NOACCOUNT: [AccountStatus.ACTIVE],
+ AccountStatus.NOACCOUNT: [AccountStatus.ACTIVE, AccountStatus.CLOSED],
AccountStatus.ACTIVE: [
AccountStatus.DEACTIVATED, AccountStatus.SUSPENDED,
AccountStatus.CLOSED],
=== modified file 'lib/lp/services/identity/tests/test_account.py'
--- lib/lp/services/identity/tests/test_account.py 2018-11-29 18:25:03 +0000
+++ lib/lp/services/identity/tests/test_account.py 2018-12-04 17:56:17 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for `Account` objects."""
@@ -50,14 +50,13 @@
self.assertEqual(status, account.status)
def test_status_from_noaccount(self):
- # The status may change from NOACCOUNT to ACTIVE.
+ # The status may change from NOACCOUNT to ACTIVE or CLOSED.
account = self.factory.makeAccount(status=AccountStatus.NOACCOUNT)
login_celebrity('admin')
self.assertCannotTransition(
- account,
- [AccountStatus.DEACTIVATED, AccountStatus.SUSPENDED,
- AccountStatus.CLOSED])
- self.assertCanTransition(account, [AccountStatus.ACTIVE])
+ account, [AccountStatus.DEACTIVATED, AccountStatus.SUSPENDED])
+ self.assertCanTransition(
+ account, [AccountStatus.ACTIVE, AccountStatus.CLOSED])
def test_status_from_active(self):
# The status may change from ACTIVE to DEACTIVATED, SUSPENDED, or
Follow ups