aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/rest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/rest/tests')
-rw-r--r--src/mailman_pgp/rest/tests/test_lists.py59
1 files changed, 34 insertions, 25 deletions
diff --git a/src/mailman_pgp/rest/tests/test_lists.py b/src/mailman_pgp/rest/tests/test_lists.py
index 365cd05..900e8b9 100644
--- a/src/mailman_pgp/rest/tests/test_lists.py
+++ b/src/mailman_pgp/rest/tests/test_lists.py
@@ -24,6 +24,7 @@ from mailman.interfaces.action import Action
from mailman.testing.helpers import call_api
from pgpy import PGPKey
+from mailman_pgp.config import config
from mailman_pgp.database import mm_transaction, transaction
from mailman_pgp.model.list import PGPMailingList
from mailman_pgp.testing.layers import PGPRESTLayer
@@ -91,44 +92,52 @@ class TestListConfig(TestCase):
self.pgp_list.key = self.list_key
def test_put(self):
- config = dict(unsigned_msg_action='defer',
- inline_pgp_action='defer',
- expired_sig_action='defer',
- revoked_sig_action='defer',
- invalid_sig_action='defer',
- duplicate_sig_action='defer',
- strip_original_sig=False,
- sign_outgoing=True,
- nonencrypted_msg_action='defer',
- encrypt_outgoing=False)
+ cfg = dict(unsigned_msg_action='defer',
+ inline_pgp_action='defer',
+ expired_sig_action='defer',
+ revoked_sig_action='defer',
+ invalid_sig_action='defer',
+ duplicate_sig_action='defer',
+ strip_original_sig=False,
+ sign_outgoing=True,
+ nonencrypted_msg_action='defer',
+ encrypt_outgoing=False,
+ key_change_workflow='pgp-key-change-mod-workflow',
+ key_signing_allowed=['member', 'owner'])
json, response = call_api(
'http://localhost:9001/3.1/plugins/pgp/lists/'
'test.example.com',
- data=config,
+ data=cfg,
method='PUT')
self.assertEqual(response.status_code, 204)
- for key in config:
+ for key in cfg:
attr = getattr(self.pgp_list, key)
if isinstance(attr, Action):
- attr = attr.name
- self.assertEqual(attr, config[key])
+ self.assertEqual(attr.name, cfg[key])
+ elif key == 'key_signing_allowed':
+ attr = [enum.name for enum in attr]
+ self.assertEqual(attr, sorted(cfg[key]))
+ else:
+ self.assertEqual(attr, cfg[key])
def test_put_wrong_value(self):
- config = dict(unsigned_msg_action='not-an-action',
- inline_pgp_action='defer',
- expired_sig_action='defer',
- revoked_sig_action='defer',
- invalid_sig_action='defer',
- duplicate_sig_action='defer',
- strip_original_sig=False,
- sign_outgoing=True,
- nonencrypted_msg_action='defer',
- encrypt_outgoing=False)
+ cfg = dict(unsigned_msg_action='not-an-action',
+ inline_pgp_action='defer',
+ expired_sig_action='defer',
+ revoked_sig_action='defer',
+ invalid_sig_action='defer',
+ duplicate_sig_action='defer',
+ strip_original_sig=False,
+ sign_outgoing=True,
+ nonencrypted_msg_action='defer',
+ encrypt_outgoing=False,
+ key_change_workflow='pgp-key-change-mod-workflow',
+ key_signing_allowed=['member', 'owner'])
with self.assertRaises(HTTPError) as cm:
call_api('http://localhost:9001/3.1/plugins/pgp/lists/'
'test.example.com',
- data=config,
+ data=cfg,
method='PUT')
self.assertEqual(cm.exception.code, 400)