aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/rest/tests/test_lists.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/rest/tests/test_lists.py')
-rw-r--r--src/mailman_pgp/rest/tests/test_lists.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mailman_pgp/rest/tests/test_lists.py b/src/mailman_pgp/rest/tests/test_lists.py
index 5d7c6aa..cae3138 100644
--- a/src/mailman_pgp/rest/tests/test_lists.py
+++ b/src/mailman_pgp/rest/tests/test_lists.py
@@ -272,6 +272,23 @@ class TestListKey(TestCase):
method='PUT')
self.assertEqual(cm.exception.code, 400)
+ def test_set_list_key_public(self):
+ new_key = load_key('rsa_1024.priv.asc')
+ with self.assertRaises(HTTPError) as cm:
+ call_api('http://localhost:9001/3.1/plugins/pgp/lists/'
+ 'test.example.com/key',
+ data=dict(key=str(new_key.pubkey)),
+ method='PUT')
+
+ self.assertEqual(cm.exception.code, 400)
+
+ json, response = call_api(
+ 'http://localhost:9001/3.1/plugins/pgp/lists/'
+ 'test.example.com/key')
+
+ key, _ = PGPKey.from_blob(json['key'])
+ self.assertEqual(key.fingerprint, self.list_key.fingerprint)
+
def test_get_list_pubkey(self):
json, response = call_api(
'http://localhost:9001/3.1/plugins/pgp/lists/'