diff options
| author | Barry Warsaw | 2016-04-02 18:09:03 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-04-02 18:09:03 -0400 |
| commit | d6e4ffe4c8db7555ed260d211dd6eedbb8f1f7b2 (patch) | |
| tree | aecbdd8f127fad10ce988fe48041606ff31dd888 /src/mailman/rest/tests/test_root.py | |
| parent | fc75d403ebcab3a7a3a8d9f838044cd885649907 (diff) | |
| download | mailman-d6e4ffe4c8db7555ed260d211dd6eedbb8f1f7b2.tar.gz mailman-d6e4ffe4c8db7555ed260d211dd6eedbb8f1f7b2.tar.zst mailman-d6e4ffe4c8db7555ed260d211dd6eedbb8f1f7b2.zip | |
Diffstat (limited to 'src/mailman/rest/tests/test_root.py')
| -rw-r--r-- | src/mailman/rest/tests/test_root.py | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/src/mailman/rest/tests/test_root.py b/src/mailman/rest/tests/test_root.py index 164f27f91..dc3acce20 100644 --- a/src/mailman/rest/tests/test_root.py +++ b/src/mailman/rest/tests/test_root.py @@ -63,38 +63,6 @@ class TestRoot(unittest.TestCase): call_api('http://localhost:9001/3.0/system/foo') self.assertEqual(cm.exception.code, 404) - def test_system_pipelines_are_exposed(self): - json, response = call_api('http://localhost:9001/3.0/system/pipelines') - self.assertEqual(json['pipelines'], sorted(config.pipelines)) - - def test_system_pipelines_are_read_only(self): - with self.assertRaises(HTTPError) as cm: - call_api('http://localhost:9001/3.0/system/pipelines', { - 'pipelines': ['pipeline_1', 'pipeline_2'] - }, method='PATCH') - self.assertEqual(cm.exception.code, 405) - with self.assertRaises(HTTPError) as cm: - call_api('http://localhost:9001/3.0/system/pipelines', { - 'pipelines': ['pipeline_1', 'pipeline_2'] - }, method='PUT') - self.assertEqual(cm.exception.code, 405) - - def test_system_chains_are_exposed(self): - json, response = call_api('http://localhost:9001/3.0/system/chains') - self.assertEqual(json['chains'], sorted(config.chains)) - - def test_system_chains_are_read_only(self): - with self.assertRaises(HTTPError) as cm: - call_api('http://localhost:9001/3.0/system/chains', { - 'chains': ['chain_1', 'chain_2'] - }, method='PATCH') - self.assertEqual(cm.exception.code, 405) - with self.assertRaises(HTTPError) as cm: - call_api('http://localhost:9001/3.0/system/chains', { - 'chains': ['chain_1', 'chain_2'] - }, method='PUT') - self.assertEqual(cm.exception.code, 405) - def test_system_preferences_are_read_only(self): # /system/preferences are read-only. with self.assertRaises(HTTPError) as cm: @@ -157,3 +125,45 @@ class TestRoot(unittest.TestCase): call_api('http://localhost:9001/3.0/reserved/uids/assigned', method='DELETE') self.assertEqual(cm.exception.code, 404) + + def test_system_pipelines_are_exposed(self): + json, response = call_api('http://localhost:9001/3.0/system/pipelines') + self.assertEqual(json['pipelines'], sorted(config.pipelines)) + + def test_system_pipelines_bad_request(self): + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/pipelines/bogus') + self.assertEqual(cm.exception.code, 400) + + def test_system_pipelines_are_read_only(self): + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/pipelines', { + 'pipelines': ['pipeline_1', 'pipeline_2'] + }, method='PATCH') + self.assertEqual(cm.exception.code, 405) + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/pipelines', { + 'pipelines': ['pipeline_1', 'pipeline_2'] + }, method='PUT') + self.assertEqual(cm.exception.code, 405) + + def test_system_chains_are_exposed(self): + json, response = call_api('http://localhost:9001/3.0/system/chains') + self.assertEqual(json['chains'], sorted(config.chains)) + + def test_system_chains_bad_request(self): + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/chains/bogus') + self.assertEqual(cm.exception.code, 400) + + def test_system_chains_are_read_only(self): + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/chains', { + 'chains': ['chain_1', 'chain_2'] + }, method='PATCH') + self.assertEqual(cm.exception.code, 405) + with self.assertRaises(HTTPError) as cm: + call_api('http://localhost:9001/3.0/system/chains', { + 'chains': ['chain_1', 'chain_2'] + }, method='PUT') + self.assertEqual(cm.exception.code, 405) |
