diff options
| author | J08nY | 2017-07-31 22:40:01 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-31 22:40:01 +0200 |
| commit | 39291794b39b52804b2b45d74d0d5aad0f0eefcf (patch) | |
| tree | 2a606169dcd655f5dc5b69b1770fa1fd72a5298e /src/mailman_pgp/model/tests/test_list.py | |
| parent | b16fe8644ddc82584a8ff9a2f98e40c1571437f2 (diff) | |
| download | mailman-pgp-feature/key-store.tar.gz mailman-pgp-feature/key-store.tar.zst mailman-pgp-feature/key-store.zip | |
Diffstat (limited to 'src/mailman_pgp/model/tests/test_list.py')
| -rw-r--r-- | src/mailman_pgp/model/tests/test_list.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mailman_pgp/model/tests/test_list.py b/src/mailman_pgp/model/tests/test_list.py index 58f52f2..aa07a79 100644 --- a/src/mailman_pgp/model/tests/test_list.py +++ b/src/mailman_pgp/model/tests/test_list.py @@ -16,15 +16,18 @@ # this program. If not, see <http://www.gnu.org/licenses/>. """""" +from os.path import exists from unittest import TestCase from mailman.app.lifecycle import create_list from mailman.interfaces.listmanager import IListManager from zope.component import getUtility +from mailman_pgp.config import config from mailman_pgp.database import mm_transaction from mailman_pgp.model.list import PGPMailingList from mailman_pgp.testing.layers import PGPConfigLayer +from mailman_pgp.testing.pgp import load_key class TestPGPMailingList(TestCase): @@ -34,8 +37,22 @@ class TestPGPMailingList(TestCase): with mm_transaction(): self.mlist = create_list('test@example.com', style_name='pgp-default') + pgp_list = PGPMailingList.for_list(self.mlist) + pgp_list.key = load_key('rsa_1024.priv.asc') def test_delete(self): getUtility(IListManager).delete(self.mlist) pgp_list = PGPMailingList.for_list(self.mlist) self.assertIsNone(pgp_list) + + def test_shred_key(self): + key_path = PGPMailingList.for_list(self.mlist).key_path + getUtility(IListManager).delete(self.mlist) + self.assertFalse(exists(key_path)) + + def test_delete_key(self): + self.addCleanup(config.set, 'keypairs', 'shred', 'yes') + config.set('keypairs', 'shred', 'no') + key_path = PGPMailingList.for_list(self.mlist).key_path + getUtility(IListManager).delete(self.mlist) + self.assertFalse(exists(key_path)) |
