Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
d0422ba6 by Mark Sapiro at 2021-04-30T08:37:01-07:00
Revert 'fix' for bogus #858 and further test cleanup.

- - - - -
72ceb26d by Mark Sapiro at 2021-04-30T16:06:12+00:00
Merge branch '858' into 'master'

Revert 'fix' for bogus #858 and further test cleanup.

See merge request mailman/mailman!848
- - - - -


3 changed files:

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


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -50,8 +50,6 @@ Bugs
   says.  (Closes #169)
 * Some exceptions in ARC signing of some posts from HyperKitty and some from
   prod.outlook.com are now handled without shunting the message.  (Closes #885)
-* Command runner now will remove all non-ascii characters in the message
-  subject before processing it.(Closes #858)
 * Command runner now will decode the message body before processing it.
  (Closes #859)
 * The ``mailinglist`` table ``info`` column is changed to Text.  (Closes #840


=====================================
src/mailman/runners/command.py
=====================================
@@ -84,9 +84,7 @@ class CommandFinder:
         try:
             subject = str(make_header(decode_header(raw_subject)))
             # Mail commands must be ASCII.
-            # NOTE(tommylikehu): remove all none ascii characters via encoding
-            # with ignore option.
-            self.command_lines.append(subject.encode('us-ascii', 'ignore'))
+            self.command_lines.append(subject.encode('us-ascii'))
         except (HeaderParseError, UnicodeError, LookupError):
             # The Subject header was unparseable or not ASCII.  If the raw
             # subject is a unicode object, convert it to ASCII ignoring all


=====================================
src/mailman/runners/tests/test_confirm.py
=====================================
@@ -91,12 +91,11 @@ To: test-conf...@example.com
         self.assertEqual(address.email, 'a...@example.org')
 
     def test_confirm_with_non_ascii_prefix(self):
-        subject = '=?utf-8?b?5Zue5aSN?=confirm {}'.format(self._token)
         msg = mfs("""\
 From: a...@example.org
 To: test-conf...@example.com
 """)
-        msg['Subject'] = subject
+        msg['Subject'] = '=?utf-8?b?5Zue5aSN?= confirm {}'.format(self._token)
         self._commandq.enqueue(msg, dict(listid='test.example.com'))
         self._runner.run()
         # Anne is now a confirmed member so her user record and email address
@@ -110,15 +109,15 @@ To: test-conf...@example.com
         address = manager.get_address('a...@example.org')
         self.assertEqual(address.email, 'a...@example.org')
 
-    def test_confirm_with_base64_encoded_body(self):
+    def test_confirm_with_command_in_base64_encoded_body(self):
         # Clear out the virgin queue so that the test below only sees the
         # reply to the confirmation message.
         get_queue_messages('virgin')
-        mail_content = "hello from mailman fake user"
-        subject = 'Re: confirm {}'.format(self._token)
-        to = 'test-confirm+{}@example.com'.format(self._token)
+        mail_content = 'confirm {}'.format(self._token)
         msg = mfs("""\
 From: Anne Person <a...@example.org>
+To: test-conf...@example.com
+Subject: 'Re: Your confirmation ...'
 MIME-Version: 1.0
 Content-Type: text/plain; charset=utf-8
 Content-Transfer-Encoding: base64
@@ -126,8 +125,6 @@ Content-Disposition: inline
 
 {}
 """.format(base64.encodebytes(mail_content.encode()).decode()))
-        msg['Subject'] = subject
-        msg['To'] = to
         self._commandq.enqueue(msg, dict(listid='test.example.com'))
         self._runner.run()
         # Anne is now a confirmed member so her user record and email address
@@ -136,12 +133,12 @@ Content-Disposition: inline
         user = manager.get_user('a...@example.org')
         address = list(user.addresses)[0]
         self.assertEqual(address.email, 'a...@example.org')
+        self.assertEqual(address.verified_on, datetime(2005, 8, 1, 7, 49, 23))
         address = manager.get_address('a...@example.org')
         self.assertEqual(address.email, 'a...@example.org')
         items = get_queue_messages('virgin', expected_count=1)
         self.assertEqual(items[0].msgdata['recipients'],
                          set(['a...@example.org']))
-        self.assertIn(mail_content, str(items[0].msg))
 
     def test_confirm_with_folded_to_header(self):
         # Test that a folded To: header is properly parsed.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/274fd8fec82bf505372cbe8f7204108dfb1b9f71...72ceb26d094dbbfb716939b5c2a3a3f66514078c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/274fd8fec82bf505372cbe8f7204108dfb1b9f71...72ceb26d094dbbfb716939b5c2a3a3f66514078c
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to