summaryrefslogtreecommitdiff
path: root/src/mailman/rest/tests/test_lists.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-10-31 17:37:22 +0100
committerBarry Warsaw2012-10-31 17:37:22 +0100
commite60c151e0148c2f53eabe883f5921378ca6a845c (patch)
tree74a926cfe64066ebffcf9adb89e7672289173d84 /src/mailman/rest/tests/test_lists.py
parenta1666479d87e26e5c79dd1cf507b8ef0472c59aa (diff)
parenta9464c14fc6dfc23613a1ec89446393fe6476f88 (diff)
downloadmailman-e60c151e0148c2f53eabe883f5921378ca6a845c.tar.gz
mailman-e60c151e0148c2f53eabe883f5921378ca6a845c.tar.zst
mailman-e60c151e0148c2f53eabe883f5921378ca6a845c.zip
Diffstat (limited to 'src/mailman/rest/tests/test_lists.py')
-rw-r--r--src/mailman/rest/tests/test_lists.py32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/mailman/rest/tests/test_lists.py b/src/mailman/rest/tests/test_lists.py
index cd0ebaf8e..9686ce6a8 100644
--- a/src/mailman/rest/tests/test_lists.py
+++ b/src/mailman/rest/tests/test_lists.py
@@ -46,47 +46,31 @@ class TestListsMissing(unittest.TestCase):
def test_missing_list_roster_member_404(self):
# /lists/<missing>/roster/member gives 404
- try:
- # For Python 2.6.
+ with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/missing@example.com'
'/roster/member')
- except HTTPError as exc:
- self.assertEqual(exc.code, 404)
- else:
- raise AssertionError('Expected HTTPError')
+ self.assertEqual(cm.exception.code, 404)
def test_missing_list_roster_owner_404(self):
# /lists/<missing>/roster/owner gives 404
- try:
- # For Python 2.6.
+ with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/missing@example.com'
'/roster/owner')
- except HTTPError as exc:
- self.assertEqual(exc.code, 404)
- else:
- raise AssertionError('Expected HTTPError')
+ self.assertEqual(cm.exception.code, 404)
def test_missing_list_roster_moderator_404(self):
# /lists/<missing>/roster/member gives 404
- try:
- # For Python 2.6.
+ with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.0/lists/missing@example.com'
'/roster/moderator')
- except HTTPError as exc:
- self.assertEqual(exc.code, 404)
- else:
- raise AssertionError('Expected HTTPError')
+ self.assertEqual(cm.exception.code, 404)
def test_missing_list_configuration_404(self):
# /lists/<missing>/config gives 404
- try:
- # For Python 2.6.
+ with self.assertRaises(HTTPError) as cm:
call_api(
'http://localhost:9001/3.0/lists/missing@example.com/config')
- except HTTPError as exc:
- self.assertEqual(exc.code, 404)
- else:
- raise AssertionError('Expected HTTPError')
+ self.assertEqual(cm.exception.code, 404)