diff options
| author | Barry Warsaw | 2013-03-06 16:59:15 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2013-03-06 16:59:15 -0500 |
| commit | 755b0d51fd488c746efd0f315510616b441ddafe (patch) | |
| tree | 8b99c80e7945cd951e45e0f80b688afcbff5c272 /src | |
| parent | ccf27cb86faeac19fb4045faa8a0624111adb40d (diff) | |
| download | mailman-755b0d51fd488c746efd0f315510616b441ddafe.tar.gz mailman-755b0d51fd488c746efd0f315510616b441ddafe.tar.zst mailman-755b0d51fd488c746efd0f315510616b441ddafe.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/model/listmanager.py | 1 | ||||
| -rw-r--r-- | src/mailman/model/tests/test_listmanager.py | 14 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_lmtp.py | 27 |
4 files changed, 44 insertions, 0 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index fcf9a26c0..47998fbab 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -16,6 +16,8 @@ Bugs ---- * Non-queue runners should not create ``var/queue`` subdirectories. Fixed by Sandesh Kumar Agrawal. (LP: #1095422) + * Creation of lists with upper case names should be coerced to lower case. + (LP: #1117176) 3.0 beta 3 -- "Here Again" diff --git a/src/mailman/model/listmanager.py b/src/mailman/model/listmanager.py index b3b8d38e4..5e260a6cd 100644 --- a/src/mailman/model/listmanager.py +++ b/src/mailman/model/listmanager.py @@ -45,6 +45,7 @@ class ListManager: @dbconnection def create(self, store, fqdn_listname): """See `IListManager`.""" + fqdn_listname = fqdn_listname.lower() listname, at, hostname = fqdn_listname.partition('@') if len(hostname) == 0: raise InvalidEmailAddressError(fqdn_listname) diff --git a/src/mailman/model/tests/test_listmanager.py b/src/mailman/model/tests/test_listmanager.py index 3dabdbc5c..152d96b9f 100644 --- a/src/mailman/model/tests/test_listmanager.py +++ b/src/mailman/model/tests/test_listmanager.py @@ -125,3 +125,17 @@ Message-ID: <argon> self.assertEqual(request, None) saved_message = getUtility(IMessageStore).get_message_by_id('<argon>') self.assertEqual(saved_message.as_string(), msg.as_string()) + + + +class TestListCreation(unittest.TestCase): + layer = ConfigLayer + + def test_create_list_case_folding(self): + # LP: #1117176 describes a problem where list names created in upper + # case are not actually usable by the LMTP server. + manager = getUtility(IListManager) + manager.create('my-LIST@example.com') + self.assertIsNone(manager.get('my-LIST@example.com')) + mlist = manager.get('my-list@example.com') + self.assertEqual(mlist.list_id, 'my-list.example.com') diff --git a/src/mailman/runners/tests/test_lmtp.py b/src/mailman/runners/tests/test_lmtp.py index a5c2105d9..bd30fc7aa 100644 --- a/src/mailman/runners/tests/test_lmtp.py +++ b/src/mailman/runners/tests/test_lmtp.py @@ -117,3 +117,30 @@ Message-ID: <ant> # directory in var/queue. queue_directory = os.path.join(config.QUEUE_DIR, 'lmtp') self.assertFalse(os.path.isdir(queue_directory)) + + + +class TestBugs(unittest.TestCase): + """Test some LMTP related bugs.""" + + layer = LMTPLayer + + def setUp(self): + self._lmtp = get_lmtp_client(quiet=True) + self._lmtp.lhlo('remote.example.org') + + def test_lp1117176(self): + # Upper cased list names can't be sent to via LMTP. + with transaction(): + create_list('my-LIST@example.com') + self._lmtp.sendmail('anne@example.com', ['my-list@example.com'], """\ +From: anne@example.com +To: my-list@example.com +Subject: My subject +Message-ID: <alpha> + +""") + messages = get_queue_messages('in') + self.assertEqual(len(messages), 1) + self.assertEqual(messages[0].msgdata['listname'], + 'my-list@example.com') |
