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


Commits:
f0c1b412 by Mark Sapiro at 2020-02-19T14:02:43-08:00
Removed incorrect member is None assertion when confirming a
confirm_then_moderate unsubscription.

- - - - -
a9bbf529 by Mark Sapiro at 2020-02-27T16:50:06+00:00
Merge branch 'fix_553' into 'master'

Removed incorrect member is None assertion when confirming a 
confirm_then_moderate unsubscription.

Closes #553

See merge request mailman/mailman!603
- - - - -


3 changed files:

- src/mailman/commands/eml_confirm.py
- src/mailman/commands/tests/test_eml_confirm.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/commands/eml_confirm.py
=====================================
@@ -55,14 +55,14 @@ class Confirm:
             if new_token is None:
                 assert token_owner is TokenOwner.no_one, token_owner
                 # We can't assert anything about member.  It will be None when
-                # the workflow we're confirming is an unsubscription request,
-                # and non-None when we're confirming a subscription request.
+                # the workflow we're confirming is a subscription request,
+                # and non-None when we're confirming an unsubscription request.
                 # This class doesn't know which is happening.
                 succeeded = True
             elif token_owner is TokenOwner.moderator:
-                # This must have been a confirm-then-moderator subscription.
+                # This must have been a confirm-then-moderate (un)subscription.
                 assert new_token != token
-                assert member is None, member
+                # We can't assert anything about member for the above reason.
                 succeeded = True
             else:
                 assert token_owner is not TokenOwner.no_one, token_owner


=====================================
src/mailman/commands/tests/test_eml_confirm.py
=====================================
@@ -121,6 +121,25 @@ Subject: Re: confirm {token}
         member = self._mlist.members.get_member('a...@example.com')
         self.assertIsNone(member)
 
+    def test_confirm_leave_moderate(self):
+        msg = mfs("""\
+From: Anne Person <a...@example.com>
+To: test-confirm+{token}@example.com
+Subject: Re: confirm {token}
+
+""".format(token=self._token))
+        self._mlist.unsubscription_policy = (
+            SubscriptionPolicy.confirm_then_moderate)
+        # Clear any previously queued confirmation messages.
+        get_queue_messages('virgin')
+        Confirm().process(self._mlist, msg, {}, (self._token,), Results())
+        # Anne is still a member of the mailing list.
+        member = self._mlist.members.get_member('a...@example.com')
+        self.assertIsNotNone(member)
+        # There should be a notice to the list owners
+        item = get_queue_messages('virgin', expected_count=1)[0]
+        self.assertEqual(item.msg['to'], 'test-ow...@example.com')
+
 
 class TestEmailResponses(unittest.TestCase):
     """Test the `confirm` command through the command runner."""


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -44,6 +44,8 @@ Bugs
 * Find members API now searches for the Member's display name too. (Closes 
#667)
 * Content filtering ``convert_html_to_plaintext`` no longer creates messages
   that can't be flattened as_bytes.  (Closes #677)
+* Removed an incorrect failing assertion when confirming a 
confirm_then_moderate
+  unsubscription.  (Closes #553)
 
 REST
 ----



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a76a1e64ae9d86c1ec94f8e2c66742e0778f0355...a9bbf52985193314622d8737baa031588c247efc

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/a76a1e64ae9d86c1ec94f8e2c66742e0778f0355...a9bbf52985193314622d8737baa031588c247efc
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