diff options
| author | Barry Warsaw | 2016-11-26 05:05:45 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2016-11-26 05:05:45 +0000 |
| commit | ada923b841f9c6d86a397d1ffcd7532ce9dc20dc (patch) | |
| tree | 05ff6a88413597e911e74c5b42d54a5874469eae /src/mailman/rest | |
| parent | b4c663e717f702f0ffe8a3bc9207b2eda635a32d (diff) | |
| parent | accc4f1a883d4a5757eb9b0156e58e72b77a8af7 (diff) | |
| download | mailman-ada923b841f9c6d86a397d1ffcd7532ce9dc20dc.tar.gz mailman-ada923b841f9c6d86a397d1ffcd7532ce9dc20dc.tar.zst mailman-ada923b841f9c6d86a397d1ffcd7532ce9dc20dc.zip | |
Merge branch 'hide-system-disabled-archivers' into 'master'
Don't show the disabled archivers in the REST API
Previously, system-disabled archivers were shown in the REST API. As a result it was possible to enable them without a validation error, but they would stay disabled on the next API GET call (their actual activation status depends on the list-specific *and* the system-wide status).
Because one can't add a configuration overlay to the running REST server
in testing mode, the prototype archiver was disabled in the testing
configuration. This is where most of the changes in this commit come
from.
See merge request !87
Diffstat (limited to 'src/mailman/rest')
| -rw-r--r-- | src/mailman/rest/docs/lists.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/lists.py | 6 | ||||
| -rw-r--r-- | src/mailman/rest/tests/test_lists.py | 8 |
3 files changed, 7 insertions, 11 deletions
diff --git a/src/mailman/rest/docs/lists.rst b/src/mailman/rest/docs/lists.rst index 247b2f4e7..6a034df94 100644 --- a/src/mailman/rest/docs/lists.rst +++ b/src/mailman/rest/docs/lists.rst @@ -275,7 +275,6 @@ archivers are available, and whether they are enabled for this mailing list. http_etag: "..." mail-archive: True mhonarc: True - prototype: True You can set all the archiver states by putting new state flags on the resource. @@ -285,7 +284,6 @@ resource. ... 'http://localhost:9001/3.0/lists/dog@example.com/archivers', { ... 'mail-archive': False, ... 'mhonarc': True, - ... 'prototype': False, ... }, method='PUT') content-length: 0 date: ... @@ -296,7 +294,6 @@ resource. http_etag: "..." mail-archive: False mhonarc: True - prototype: False You can change the state of a subset of the list archivers. :: @@ -314,7 +311,6 @@ You can change the state of a subset of the list archivers. http_etag: "..." mail-archive: False mhonarc: False - prototype: False List digests diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py index 8952f1156..1fdf595fb 100644 --- a/src/mailman/rest/lists.py +++ b/src/mailman/rest/lists.py @@ -337,13 +337,15 @@ class ListArchivers: """Get all the archiver statuses.""" archiver_set = IListArchiverSet(self._mlist) resource = {archiver.name: archiver.is_enabled - for archiver in archiver_set.archivers} + for archiver in archiver_set.archivers + if archiver.system_archiver.is_enabled} okay(response, etag(resource)) def patch_put(self, request, response, is_optional): archiver_set = IListArchiverSet(self._mlist) kws = {archiver.name: ArchiverGetterSetter(self._mlist) - for archiver in archiver_set.archivers} + for archiver in archiver_set.archivers + if archiver.system_archiver.is_enabled} if is_optional: # For a PATCH, all attributes are optional. kws['_optional'] = kws.keys() diff --git a/src/mailman/rest/tests/test_lists.py b/src/mailman/rest/tests/test_lists.py index da6e95f3b..49764f86f 100644 --- a/src/mailman/rest/tests/test_lists.py +++ b/src/mailman/rest/tests/test_lists.py @@ -339,7 +339,6 @@ class TestListArchivers(unittest.TestCase): self.assertEqual(resource, { 'mail-archive': True, 'mhonarc': True, - 'prototype': True, }) def test_archiver_statuses_on_missing_lists(self): @@ -375,7 +374,7 @@ class TestListArchivers(unittest.TestCase): def test_put_incomplete_statuses(self): # PUT requires the full resource representation. This one forgets to - # specify the prototype and mhonarc archiver. + # specify the mhonarc archiver. with self.assertRaises(HTTPError) as cm: call_api( 'http://localhost:9001/3.0/lists/ant.example.com/archivers', { @@ -384,7 +383,7 @@ class TestListArchivers(unittest.TestCase): method='PUT') self.assertEqual(cm.exception.code, 400) self.assertEqual(cm.exception.reason, - b'Missing parameters: mhonarc, prototype') + b'Missing parameters: mhonarc') def test_patch_bogus_status(self): # Archiver statuses must be interpretable as booleans. @@ -392,8 +391,7 @@ class TestListArchivers(unittest.TestCase): call_api( 'http://localhost:9001/3.0/lists/ant.example.com/archivers', { 'mail-archive': 'sure', - 'mhonarc': False, - 'prototype': 'no' + 'mhonarc': 'no' }, method='PATCH') self.assertEqual(cm.exception.code, 400) |
