diff options
| author | J08nY | 2017-08-18 17:30:11 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-18 17:30:11 +0200 |
| commit | 54ad58f448f23cd26bbfad6abcfe5e4ca9b686ee (patch) | |
| tree | 192613f595dcca4f28b2c7e53a427b8a0a63b758 /src/mailman_pgp/rest/tests/test_lists.py | |
| parent | 680ae1be88d22f2eb5d6f16a58acda4e5927ed72 (diff) | |
| download | mailman-pgp-54ad58f448f23cd26bbfad6abcfe5e4ca9b686ee.tar.gz mailman-pgp-54ad58f448f23cd26bbfad6abcfe5e4ca9b686ee.tar.zst mailman-pgp-54ad58f448f23cd26bbfad6abcfe5e4ca9b686ee.zip | |
Diffstat (limited to 'src/mailman_pgp/rest/tests/test_lists.py')
| -rw-r--r-- | src/mailman_pgp/rest/tests/test_lists.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mailman_pgp/rest/tests/test_lists.py b/src/mailman_pgp/rest/tests/test_lists.py index cae3138..c97c392 100644 --- a/src/mailman_pgp/rest/tests/test_lists.py +++ b/src/mailman_pgp/rest/tests/test_lists.py @@ -16,6 +16,7 @@ # this program. If not, see <http://www.gnu.org/licenses/>. """""" +from copy import copy from unittest import TestCase from urllib.error import HTTPError @@ -311,3 +312,26 @@ class TestListKey(TestCase): call_api('http://localhost:9001/3.1/plugins/pgp/lists/' 'test.example.com/pubkey') self.assertEqual(cm.exception.code, 404) + + def test_set_list_pubkey(self): + signer_key = load_key('rsa_1024.priv.asc') + signed = copy(self.list_key.pubkey) + uid = next(iter(signed.userids)) + sig = signer_key.certify(uid) + uid |= sig + + json, response = call_api( + 'http://localhost:9001/3.1/plugins/pgp/lists/' + 'test.example.com/pubkey', + data=dict(public_key=str(signed)), + method='PUT') + + self.assertEqual(response.status_code, 202) + + json, response = call_api( + 'http://localhost:9001/3.1/plugins/pgp/lists/' + 'test.example.com/pubkey') + + key, _ = PGPKey.from_blob(json['public_key']) + uid = next(iter(key.userids)) + self.assertIn(sig, list(uid.signatures)) |
