~barry/mailman/templatecache

« back to all changes in this revision

Viewing changes to src/mailman/rest/tests/test_domains.py

  • Committer: Barry Warsaw
  • Date: 2012-10-31 16:37:22 UTC
  • mfrom: (7178.1.1 work2)
  • Revision ID: barry@list.org-20121031163722-3lszhsiv9ai0akfp
 * Python 2.7 is not required.  Python 2.6 is no longer officially supported.
   The code base is now also `python2.7 -3` clean, although there are still
   some warnings in 3rd party dependencies.  LP: #1073506

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
    def test_bogus_endpoint_extension(self):
49
49
        # /domains/<domain>/lists/<anything> is not a valid endpoint.
50
 
        try:
51
 
            # For Python 2.6.
 
50
        with self.assertRaises(HTTPError) as cm:
52
51
            call_api('http://localhost:9001/3.0/domains/example.com'
53
52
                     '/lists/wrong')
54
 
        except HTTPError as exc:
55
 
            self.assertEqual(exc.code, 400)
56
 
        else:
57
 
            raise AssertionError('Expected HTTPError')
 
53
        self.assertEqual(cm.exception.code, 400)
58
54
 
59
55
    def test_bogus_endpoint(self):
60
56
        # /domains/<domain>/<!lists> does not exist.
61
 
        try:
62
 
            # For Python 2.6.
 
57
        with self.assertRaises(HTTPError) as cm:
63
58
            call_api('http://localhost:9001/3.0/domains/example.com/wrong')
64
 
        except HTTPError as exc:
65
 
            self.assertEqual(exc.code, 404)
66
 
        else:
67
 
            raise AssertionError('Expected HTTPError')
 
59
        self.assertEqual(cm.exception.code, 404)
68
60
 
69
61
    def test_lists_are_deleted_when_domain_is_deleted(self):
70
62
        # /domains/<domain> DELETE removes all associated mailing lists.