aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/testing')
-rw-r--r--src/mailman_pgp/testing/layers.py10
-rw-r--r--src/mailman_pgp/testing/mailman.cfg33
-rw-r--r--src/mailman_pgp/testing/mailman_pgp.cfg61
3 files changed, 99 insertions, 5 deletions
diff --git a/src/mailman_pgp/testing/layers.py b/src/mailman_pgp/testing/layers.py
index fb8a3ec..07eb386 100644
--- a/src/mailman_pgp/testing/layers.py
+++ b/src/mailman_pgp/testing/layers.py
@@ -19,6 +19,7 @@ import os
from os.path import isfile
from mailman.testing.layers import (ConfigLayer, RESTLayer, SMTPLayer)
+from sqlalchemy.exc import SQLAlchemyError
from mailman_pgp.config import config
from mailman_pgp.database import transaction
@@ -51,7 +52,10 @@ def reset_pgp_soft():
with contextlib.closing(config.db.engine.connect()) as con:
trans = con.begin()
for table in reversed(Base.metadata.sorted_tables):
- con.execute(table.delete())
+ try:
+ con.execute(table.delete())
+ except SQLAlchemyError:
+ pass
trans.commit()
@@ -60,10 +64,6 @@ def reset_pgp_soft():
# and subclass both it and the respective Mailman Core test layer.
class PGPConfigLayer(ConfigLayer):
@classmethod
- def setUp(cls):
- config.set('keypairs', 'autogenerate', 'no')
-
- @classmethod
def tearDown(cls):
reset_pgp_soft()
diff --git a/src/mailman_pgp/testing/mailman.cfg b/src/mailman_pgp/testing/mailman.cfg
new file mode 100644
index 0000000..d9401ca
--- /dev/null
+++ b/src/mailman_pgp/testing/mailman.cfg
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 Jan Jancar
+#
+# This file is a part of the Mailman PGP plugin.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Testing Mailman config
+
+[plugin.pgp]
+class: mailman_pgp.plugin.PGPMailman
+path: mailman_pgp
+enable: yes
+configuration: python:mailman_pgp.testing.mailman_pgp
+
+[mta]
+outgoing: mailman_pgp.mta.deliver.deliver
+
+[runner.in]
+class: mailman_pgp.runners.incoming.PGPIncomingRunner
+
+[runner.in_default]
+class: mailman.runners.incoming.IncomingRunner
diff --git a/src/mailman_pgp/testing/mailman_pgp.cfg b/src/mailman_pgp/testing/mailman_pgp.cfg
new file mode 100644
index 0000000..871f429
--- /dev/null
+++ b/src/mailman_pgp/testing/mailman_pgp.cfg
@@ -0,0 +1,61 @@
+# Copyright (C) 2017 Jan Jancar
+#
+# This file is a part of the Mailman PGP plugin.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Testing PGP config
+
+[db]
+# db path the PGP plugin will use to store list/user configuration (not keys!).
+url = sqlite:////$DATA_DIR/pgp.db
+
+
+[keydirs]
+# Key directory used to store user public keys.
+user_keydir = $DATA_DIR/pgp/user_keydir/
+
+# Key directory used to store list keypairs.
+list_keydir = $DATA_DIR/pgp/list_keydir/
+
+# Key directory used to store archive public keys.
+archive_keydir = $DATA_DIR/pgp/archive_keydir/
+
+
+[keypairs]
+# Whether to autogenerate the list key on list creation.
+autogenerate = no
+
+# Type of primary list key and its size.
+# Format: type:size
+# type is one of:
+# RSA, DSA, ECDSA.
+# size is the key size or curve name for ECDSA, which can be one of:
+# nistp256, nistp384, nistp521, brainpoolP256r1, brainpoolP384r1,
+# brainpoolP512r1, secp256k1
+primary_key = ECDSA:secp256k1
+
+# Type of list encryption subkey and its size.
+# Format: type:size
+# type is one of:
+# RSA, ECDH
+# size is the key size or curve name for ECDH, which can be one of:
+# nistp256, nistp384, nistp521, brainpoolP256r1, brainpoolP384r1,
+# brainpoolP512r1, secp256k1
+sub_key = ECDH:secp256k1
+
+
+[queues]
+# The queue to which processed incoming messages are passed.
+in = in_default \ No newline at end of file