From c519cd8740bb3ce06ab58618bbb2e1a3d2870946 Mon Sep 17 00:00:00 2001 From: Simon Hanna Date: Sat, 2 Apr 2016 02:07:58 +0200 Subject: Add tests for exposed chains and pipelines --- src/mailman/rest/tests/test_root.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src') diff --git a/src/mailman/rest/tests/test_root.py b/src/mailman/rest/tests/test_root.py index ea2f2da5e..26041b9e6 100644 --- a/src/mailman/rest/tests/test_root.py +++ b/src/mailman/rest/tests/test_root.py @@ -63,6 +63,36 @@ 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): + call_api('http://localhost:9001/3.0/system/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): + call_api('http://localhost:9001/3.0/system/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: -- cgit v1.2.3-70-g09d2