summaryrefslogtreecommitdiff
path: root/src/mailman/rest/tests/test_domains.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-12-31 11:42:46 -0500
committerBarry Warsaw2015-12-31 11:44:27 -0500
commit35577e20f8133880377f211eded6faafb60cffd3 (patch)
tree902df082abc7919a4c8cc5a974cfd1b287780fc0 /src/mailman/rest/tests/test_domains.py
parentdac929973fbfc7ac4c807afafc22b992510b4e6d (diff)
downloadmailman-35577e20f8133880377f211eded6faafb60cffd3.tar.gz
mailman-35577e20f8133880377f211eded6faafb60cffd3.tar.zst
mailman-35577e20f8133880377f211eded6faafb60cffd3.zip
Diffstat (limited to 'src/mailman/rest/tests/test_domains.py')
-rw-r--r--src/mailman/rest/tests/test_domains.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mailman/rest/tests/test_domains.py b/src/mailman/rest/tests/test_domains.py
index 9d03859ef..5a01783d3 100644
--- a/src/mailman/rest/tests/test_domains.py
+++ b/src/mailman/rest/tests/test_domains.py
@@ -106,6 +106,13 @@ class TestDomains(unittest.TestCase):
'http://localhost:9001/3.0/domains/does-not-exist.com/lists')
self.assertEqual(cm.exception.code, 404)
+ def test_create_existing_domain(self):
+ with self.assertRaises(HTTPError) as cm:
+ call_api('http://localhost:9001/3.0/domains', dict(
+ mail_host='example.com',
+ ))
+ self.assertEqual(cm.exception.code, 400)
+
def test_double_delete(self):
# You cannot delete a domain twice.
content, response = call_api(
@@ -118,7 +125,6 @@ class TestDomains(unittest.TestCase):
self.assertEqual(cm.exception.code, 404)
-
class TestDomainOwners(unittest.TestCase):
layer = RESTLayer
@@ -129,6 +135,12 @@ class TestDomainOwners(unittest.TestCase):
call_api('http://localhost:9001/3.0/domains/example.net/owners')
self.assertEqual(cm.exception.code, 404)
+ def test_bad_domain_owners_url(self):
+ with self.assertRaises(HTTPError) as cm:
+ call_api(
+ 'http://localhost:9001/3.0/domains/example.com/owners/bogus')
+ self.assertEqual(cm.exception.code, 404)
+
def test_post_to_missing_domain_owners(self):
# Try to add owners to a missing domain.
with self.assertRaises(HTTPError) as cm: