diff options
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)) |
