summaryrefslogtreecommitdiff
path: root/src/mailman/app/tests/test_lifecycle.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/app/tests/test_lifecycle.py')
-rw-r--r--src/mailman/app/tests/test_lifecycle.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mailman/app/tests/test_lifecycle.py b/src/mailman/app/tests/test_lifecycle.py
index db36d0b64..ec7d2b771 100644
--- a/src/mailman/app/tests/test_lifecycle.py
+++ b/src/mailman/app/tests/test_lifecycle.py
@@ -26,6 +26,7 @@ from mailman.app.lifecycle import (
from mailman.interfaces.address import InvalidEmailAddressError
from mailman.interfaces.domain import BadDomainSpecificationError
from mailman.interfaces.listmanager import IListManager
+from mailman.testing.helpers import LogFileMark, configuration
from mailman.testing.layers import ConfigLayer
from zope.component import getUtility
@@ -46,6 +47,28 @@ class TestLifecycle(unittest.TestCase):
self.assertRaises(InvalidListNameError,
create_list, 'my/list@example.com')
+ @configuration('mailman', listname_chars='[a-z0-9-+\]')
+ def test_bad_config_listname_chars(self):
+ mark = LogFileMark('mailman.error')
+ # This list create should succeed but log an error
+ mlist = create_list('test@example.com')
+ # Check the error log.
+ self.assertEqual(
+ mark.readline()[-83:-1],
+ 'Bad config.mailman.listname_chars setting: '
+ '[a-z0-9-+\]: '
+ 'unterminated character set'
+ )
+ # Remove the list.
+ remove_list(mlist)
+
+ @configuration('mailman', listname_chars='[a-z]')
+ def test_listname_with_minimal_listname_chars(self):
+ # This only allows letters in the listname. A listname with digits
+ # Raises an exception.
+ self.assertRaises(InvalidListNameError,
+ create_list, 'list1@example.com')
+
def test_unregistered_domain(self):
# Creating a list with an unregistered domain raises an exception.
self.assertRaises(BadDomainSpecificationError,