diff options
| author | Barry Warsaw | 2012-10-31 17:31:12 +0100 |
|---|---|---|
| committer | Barry Warsaw | 2012-10-31 17:31:12 +0100 |
| commit | a9464c14fc6dfc23613a1ec89446393fe6476f88 (patch) | |
| tree | 74a926cfe64066ebffcf9adb89e7672289173d84 /src/mailman/app/tests/test_subscriptions.py | |
| parent | a1666479d87e26e5c79dd1cf507b8ef0472c59aa (diff) | |
| download | mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.gz mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.zst mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.zip | |
Diffstat (limited to 'src/mailman/app/tests/test_subscriptions.py')
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index 1c37d4cb9..c4c8f2795 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -51,19 +51,13 @@ class TestJoin(unittest.TestCase): def test_join_user_with_bogus_id(self): # When `subscriber` is a missing user id, an exception is raised. - try: + with self.assertRaises(MissingUserError) as cm: self._service.join('test.example.com', uuid.UUID(int=99)) - except MissingUserError as exc: - self.assertEqual(exc.user_id, uuid.UUID(int=99)) - else: - raise AssertionError('MissingUserError expected') + self.assertEqual(cm.exception.user_id, uuid.UUID(int=99)) def test_join_user_with_invalid_email_address(self): # When `subscriber` is a string that is not an email address, an # exception is raised. - try: + with self.assertRaises(InvalidEmailAddressError) as cm: self._service.join('test.example.com', 'bogus') - except InvalidEmailAddressError as exc: - self.assertEqual(exc.email, 'bogus') - else: - raise AssertionError('InvalidEmailAddressError expected') + self.assertEqual(cm.exception.email, 'bogus') |
