diff options
| author | Barry Warsaw | 2015-04-15 14:36:28 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2015-04-15 14:36:28 -0400 |
| commit | 4b42d1c4cca07396585dbfd6265ecd751b419b06 (patch) | |
| tree | b1bfa93ebaf4c7ea09fd7171f4c41793c75825ee /src/mailman/rest/tests/test_listconf.py | |
| parent | 2f2e4aa6684a0930395d56a77078aa39ee7786a5 (diff) | |
| download | mailman-4b42d1c4cca07396585dbfd6265ecd751b419b06.tar.gz mailman-4b42d1c4cca07396585dbfd6265ecd751b419b06.tar.zst mailman-4b42d1c4cca07396585dbfd6265ecd751b419b06.zip | |
Diffstat (limited to 'src/mailman/rest/tests/test_listconf.py')
| -rw-r--r-- | src/mailman/rest/tests/test_listconf.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mailman/rest/tests/test_listconf.py b/src/mailman/rest/tests/test_listconf.py index ddb43a8ea..860adac57 100644 --- a/src/mailman/rest/tests/test_listconf.py +++ b/src/mailman/rest/tests/test_listconf.py @@ -26,7 +26,8 @@ import unittest from mailman.app.lifecycle import create_list from mailman.database.transaction import transaction -from mailman.interfaces.mailinglist import IAcceptableAliasSet +from mailman.interfaces.mailinglist import ( + IAcceptableAliasSet, SubscriptionPolicy) from mailman.testing.helpers import call_api from mailman.testing.layers import RESTLayer @@ -90,3 +91,20 @@ class TestConfiguration(unittest.TestCase): # All three acceptable aliases were set. self.assertEqual(set(IAcceptableAliasSet(self._mlist).aliases), set(aliases)) + + def test_patch_subscription_policy(self): + # The new subscription_policy value can be patched. + # + # To start with, the subscription policy is confirm by default. + resource, response = call_api( + 'http://localhost:9001/3.0/lists/test@example.com/config') + self.assertEqual(resource['subscription_policy'], 'confirm') + # Let's patch it to do some moderation. + resource, response = call_api( + 'http://localhost:9001/3.0/lists/test@example.com/config', dict( + subscription_policy='confirm_then_moderate'), + method='PATCH') + self.assertEqual(response.status, 204) + # And now we verify that it has the requested setting. + self.assertEqual(self._mlist.subscription_policy, + SubscriptionPolicy.confirm_then_moderate) |
