summaryrefslogtreecommitdiff
path: root/src/mailman/model/tests/test_pending.py
diff options
context:
space:
mode:
authorAurélien Bompard2015-12-02 10:00:53 +0100
committerBarry Warsaw2015-12-16 11:04:25 -0500
commited9efb350c7629be2b8f1fe509c74e5dca6935f0 (patch)
tree58c091d1485c219ee5bfbfa0ac6d2bd8134e5829 /src/mailman/model/tests/test_pending.py
parent6e99812bc83fb96177fa14d8ee9ecd09d34c339e (diff)
downloadmailman-ed9efb350c7629be2b8f1fe509c74e5dca6935f0.tar.gz
mailman-ed9efb350c7629be2b8f1fe509c74e5dca6935f0.tar.zst
mailman-ed9efb350c7629be2b8f1fe509c74e5dca6935f0.zip
Diffstat (limited to 'src/mailman/model/tests/test_pending.py')
-rw-r--r--src/mailman/model/tests/test_pending.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/mailman/model/tests/test_pending.py b/src/mailman/model/tests/test_pending.py
index 1884c8109..c97fdc1ce 100644
--- a/src/mailman/model/tests/test_pending.py
+++ b/src/mailman/model/tests/test_pending.py
@@ -24,11 +24,10 @@ __all__ = [
import unittest
+from mailman.app.lifecycle import create_list
from mailman.config import config
-from mailman.email.validate import InvalidEmailAddressError
-from mailman.interfaces.pending import (
- IPendable, IPended, IPendedKeyValue, IPendings)
-from mailman.model.pending import PendedKeyValue, Pended, Pendings
+from mailman.interfaces.pending import IPendable, IPendings
+from mailman.model.pending import PendedKeyValue
from mailman.testing.layers import ConfigLayer
from zope.component import getUtility
from zope.interface import implementer
@@ -59,3 +58,25 @@ class TestPendings(unittest.TestCase):
pendable = pendingdb.confirm(token)
self.assertEqual(pendingdb.count, 0)
self.assertEqual(config.db.store.query(PendedKeyValue).count(), 0)
+
+ def test_find(self):
+ # Test getting pendables for a mailing-list
+ mlist = create_list('list1@example.com')
+ pendingdb = getUtility(IPendings)
+ subscription_1 = SimplePendable(
+ type='subscription',
+ list_id='list1.example.com')
+ subscription_2 = SimplePendable(
+ type='subscription',
+ list_id='list2.example.com')
+ subscription_3 = SimplePendable(
+ type='hold request',
+ list_id='list1.example.com')
+ token_1 = pendingdb.add(subscription_1)
+ pendingdb.add(subscription_2)
+ pendingdb.add(subscription_3)
+ self.assertEqual(pendingdb.count, 3)
+ mlist_pendings = list(pendingdb.find(mlist=mlist, type='subscription'))
+ self.assertEqual(len(mlist_pendings), 1)
+ self.assertEqual(mlist_pendings[0][0], token_1)
+ self.assertEqual(mlist_pendings[0][1]['list_id'], 'list1.example.com')