Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core

Commits:
408a61f0 by Abhilash Raj at 2018-09-10T01:50:31Z
Email commands should case insensitive.

Fixes #353

- - - - -
91cf6c93 by Abhilash Raj at 2018-09-10T02:42:55Z
Merge branch 'fix-353' into 'master'

Email commands should case insensitive.

Closes #353

See merge request mailman/mailman!413
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/command.py
- src/mailman/runners/tests/test_join.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -30,6 +30,11 @@ REST
 ----
 * Allow setting ``max_num_recipients`` for a mailing list. (Closes #508)
 
+  
+Other
+-----
+* Email commands are now case insensitive. (Closes #353)
+
 
 3.2.0 -- "La Villa Strangiato"
 ==============================


=====================================
src/mailman/runners/command.py
=====================================
@@ -117,9 +117,9 @@ class CommandFinder:
                 continue
             # Ensure that all the parts are unicodes.  Since we only accept
             # ASCII commands and arguments, ignore anything else.
-            parts = [(part
+            parts = [(part.lower()
                       if isinstance(part, str)
-                      else part.decode('ascii', 'ignore'))
+                      else part.decode('ascii', 'ignore').lower())
                      for part in parts]
             yield parts
 


=====================================
src/mailman/runners/tests/test_join.py
=====================================
@@ -157,6 +157,34 @@ class TestJoinWithDigests(unittest.TestCase):
         self.assertEqual(rmember, members[0])
         return rmember
 
+    def test_join_in_subject_case_insensitive(self):
+        # Test that join commands are case insensitive.
+        msg = mfs("""\
+From: a...@example.org
+To: test-reque...@example.com
+Subject: Join
+
+""")
+        self._commandq.enqueue(msg, dict(listid='test.example.com'))
+        self._runner.run()
+        anne = self._confirm()
+        self.assertEqual(anne.address.email, 'a...@example.org')
+        self.assertEqual(anne.delivery_mode, DeliveryMode.regular)
+
+    def test_join_case_insensitive(self):
+        # Test that join commands are case insensitive.
+        msg = mfs("""\
+From: a...@example.org
+To: test-reque...@example.com
+
+Join
+""")
+        self._commandq.enqueue(msg, dict(listid='test.example.com'))
+        self._runner.run()
+        anne = self._confirm()
+        self.assertEqual(anne.address.email, 'a...@example.org')
+        self.assertEqual(anne.delivery_mode, DeliveryMode.regular)
+
     def test_join_with_implicit_no_digests(self):
         # Test the digest=mime argument to the join command.
         msg = mfs("""\



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/1aa27388b68ec4e3dbc49ac6e66d0fd744c9ca92...91cf6c932d2bad0a7b62dbc36c0a83f1838335ff

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/1aa27388b68ec4e3dbc49ac6e66d0fd744c9ca92...91cf6c932d2bad0a7b62dbc36c0a83f1838335ff
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to