diff options
Diffstat (limited to 'src/mailman/app/tests/test_subscriptions.py')
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index e5aad18bc..1ba3cc24b 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -17,9 +17,6 @@ """Tests for the subscription service.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'TestJoin' ] @@ -28,13 +25,13 @@ __all__ = [ import uuid import unittest -from zope.component import getUtility - from mailman.app.lifecycle import create_list from mailman.interfaces.address import InvalidEmailAddressError +from mailman.interfaces.member import MemberRole, MissingPreferredAddressError from mailman.interfaces.subscriptions import ( MissingUserError, ISubscriptionService) from mailman.testing.layers import ConfigLayer +from zope.component import getUtility @@ -57,3 +54,14 @@ class TestJoin(unittest.TestCase): with self.assertRaises(InvalidEmailAddressError) as cm: self._service.join('test.example.com', 'bogus') self.assertEqual(cm.exception.email, 'bogus') + + def test_missing_preferred_address(self): + # A user cannot join a mailing list if they have no preferred address. + anne = self._service.join( + 'test.example.com', 'anne@example.com', 'Anne Person') + # Try to join Anne as a user with a different role. Her user has no + # preferred address, so this will fail. + self.assertRaises(MissingPreferredAddressError, + self._service.join, + 'test.example.com', anne.user.user_id, + role=MemberRole.owner) |
