aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/mta/tests/test_bulk.py
diff options
context:
space:
mode:
authorJ08nY2017-07-19 18:42:28 +0200
committerJ08nY2017-07-19 18:42:28 +0200
commitcd5a03dc4361d4fba5fb49773ce796eabc0bd8ce (patch)
tree936c13852359230b4d9447b8c019aa49b42d4151 /src/mailman_pgp/mta/tests/test_bulk.py
parentc6dbc74b6abdc26698a5c76e7374d965d19632af (diff)
downloadmailman-pgp-cd5a03dc4361d4fba5fb49773ce796eabc0bd8ce.tar.gz
mailman-pgp-cd5a03dc4361d4fba5fb49773ce796eabc0bd8ce.tar.zst
mailman-pgp-cd5a03dc4361d4fba5fb49773ce796eabc0bd8ce.zip
Add retries to both Personalized and Bulk delivery.
Diffstat (limited to 'src/mailman_pgp/mta/tests/test_bulk.py')
-rw-r--r--src/mailman_pgp/mta/tests/test_bulk.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mailman_pgp/mta/tests/test_bulk.py b/src/mailman_pgp/mta/tests/test_bulk.py
index bd0db9e..ccb4988 100644
--- a/src/mailman_pgp/mta/tests/test_bulk.py
+++ b/src/mailman_pgp/mta/tests/test_bulk.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-""""""
+"""Test the PGP enabled BulkDelivery."""
import unittest
from mailman.app.lifecycle import create_list
@@ -34,7 +34,7 @@ from mailman_pgp.utils.pgp import verifies
class BulkDeliveryTester(PGPBulkDelivery):
- """"""
+ """Save deliveries made by the PGPBulkDelivery class."""
def __init__(self, max_recipients=None):
super().__init__(max_recipients=max_recipients)
@@ -166,3 +166,30 @@ Subject: test
wrapped = PGPWrapper(out_msg)
self.assertFalse(wrapped.is_signed())
self.assertFalse(wrapped.is_encrypted())
+
+ def test_no_pgp_list(self):
+ ordinary_list = create_list('ordinary@example.com')
+ msgdata = dict(recipients=['anne@example.org', 'bart@example.org'])
+ agent = BulkDeliveryTester(2)
+ refused = agent.deliver(ordinary_list, self.msg, msgdata)
+
+ self.assertEqual(len(refused), 0)
+ self.assertEqual(len(agent.deliveries), 1)
+
+ def test_no_pgp_address(self):
+ msgdata = dict(recipients=['anne@example.org', 'someone@example.org'])
+ agent = BulkDeliveryTester(2)
+ refused = agent.deliver(self.mlist, self.msg, msgdata)
+
+ self.assertEqual(len(refused), 1)
+ self.assertEqual(len(agent.deliveries), 1)
+
+ def test_no_key(self):
+ with transaction():
+ self.pgp_bart.key = None
+ msgdata = dict(recipients=['anne@example.org', 'bart@example.org'])
+ agent = BulkDeliveryTester(2)
+ refused = agent.deliver(self.mlist, self.msg, msgdata)
+
+ self.assertEqual(len(refused), 1)
+ self.assertEqual(len(agent.deliveries), 1)