summaryrefslogtreecommitdiff
path: root/src/mailman/mta/tests/test_aliases.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-01-27 18:30:03 -0500
committerBarry Warsaw2012-01-27 18:30:03 -0500
commit78b9ea398e6671d94f958e625b640383f1d43a75 (patch)
tree8570a4109d5eec6c2f0ab201d8fd8177558e6682 /src/mailman/mta/tests/test_aliases.py
parent1655fcc1e8d1cb2e9ee19288c026c85b3b470a97 (diff)
downloadmailman-78b9ea398e6671d94f958e625b640383f1d43a75.tar.gz
mailman-78b9ea398e6671d94f958e625b640383f1d43a75.tar.zst
mailman-78b9ea398e6671d94f958e625b640383f1d43a75.zip
Diffstat (limited to 'src/mailman/mta/tests/test_aliases.py')
-rw-r--r--src/mailman/mta/tests/test_aliases.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mailman/mta/tests/test_aliases.py b/src/mailman/mta/tests/test_aliases.py
index 4c58cbba5..bf77298e6 100644
--- a/src/mailman/mta/tests/test_aliases.py
+++ b/src/mailman/mta/tests/test_aliases.py
@@ -81,6 +81,46 @@ class TestAliases(unittest.TestCase):
'test-unsubscribe',
])
+ def test_duck_typed_aliases(self):
+ # Test the .aliases() method with duck typed arguments.
+ class Duck:
+ def __init__(self, list_name, mail_host):
+ self.list_name = list_name
+ self.mail_host = mail_host
+ self.posting_address = '{0}@{1}'.format(list_name, mail_host)
+ duck_list = Duck('sample', 'example.net')
+ aliases = list(self.utility.aliases(duck_list))
+ self.assertEqual(aliases, [
+ 'sample@example.net',
+ 'sample-bounces@example.net',
+ 'sample-confirm@example.net',
+ 'sample-join@example.net',
+ 'sample-leave@example.net',
+ 'sample-owner@example.net',
+ 'sample-request@example.net',
+ 'sample-subscribe@example.net',
+ 'sample-unsubscribe@example.net',
+ ])
+
+ def test_duck_typed_destinations(self):
+ # Test the .destinations() method with duck typed arguments.
+ class Duck:
+ def __init__(self, list_name):
+ self.list_name = list_name
+ duck_list = Duck('sample')
+ destinations = list(self.utility.destinations(duck_list))
+ self.assertEqual(destinations, [
+ 'sample',
+ 'sample-bounces',
+ 'sample-confirm',
+ 'sample-join',
+ 'sample-leave',
+ 'sample-owner',
+ 'sample-request',
+ 'sample-subscribe',
+ 'sample-unsubscribe',
+ ])
+
class TestPostfix(unittest.TestCase):