diff options
| author | Barry Warsaw | 2016-02-06 17:15:41 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2016-02-06 17:15:41 -0500 |
| commit | ad7c5f7c4c530a3587949c8eaf9ad064419a6e33 (patch) | |
| tree | abae3a54e90f186c6a2fdb5cb169f0f5ec12050a /src/mailman/app/tests | |
| parent | 3a8477dc3d8ce782c36d0043fe4a5521ca5ef8a3 (diff) | |
| download | mailman-ad7c5f7c4c530a3587949c8eaf9ad064419a6e33.tar.gz mailman-ad7c5f7c4c530a3587949c8eaf9ad064419a6e33.tar.zst mailman-ad7c5f7c4c530a3587949c8eaf9ad064419a6e33.zip | |
Add a set_preferred() helper.
This refactors the setting of a user's preferred address to the first in
their list of linked addresses.
Diffstat (limited to 'src/mailman/app/tests')
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index 3cfde47bc..3aaa5887a 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -30,7 +30,8 @@ from mailman.interfaces.bans import IBanManager from mailman.interfaces.member import MembershipIsBannedError from mailman.interfaces.pending import IPendings from mailman.interfaces.subscriptions import TokenOwner -from mailman.testing.helpers import LogFileMark, get_queue_messages +from mailman.testing.helpers import ( + LogFileMark, get_queue_messages, set_preferred) from mailman.testing.layers import ConfigLayer from mailman.interfaces.mailinglist import SubscriptionPolicy from mailman.interfaces.usermanager import IUserManager @@ -95,9 +96,7 @@ class TestSubscriptionWorkflow(unittest.TestCase): # Ensure that the sanity check phase, when given an IUser with a # preferred address, ends up with an address. anne = self._user_manager.make_user(self._anne) - address = list(anne.addresses)[0] - address.verified_on = now() - anne.preferred_address = address + address = set_preferred(anne) workflow = SubscriptionWorkflow(self._mlist, anne) # The constructor sets workflow.address because the user has a # preferred address. @@ -549,9 +548,7 @@ approval: # A confirmation step is necessary when a user subscribes with their # preferred address, and we are not pre-confirming. anne = self._user_manager.create_user(self._anne) - address = list(anne.addresses)[0] - address.verified_on = now() - anne.preferred_address = address + set_preferred(anne) # Run the workflow to model the confirmation step. There is no # subscriber attribute yet. workflow = SubscriptionWorkflow(self._mlist, anne) |
