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


Commits:
8a7e82a2 by Mark Sapiro at 2021-03-14T16:25:17-07:00
The email join command now honors the digest=<no|mime|plain> option.

- - - - -
b7d2493d by Mark Sapiro at 2021-03-14T23:55:35+00:00
Merge branch 'join' into 'master'

The email join command now honors the digest=<no|mime|plain> option.

Closes #19

See merge request mailman/mailman!796
- - - - -


4 changed files:

- src/mailman/commands/eml_membership.py
- src/mailman/commands/tests/test_eml_membership.py
- src/mailman/docs/NEWS.rst
- src/mailman/runners/tests/test_join.py


Changes:

=====================================
src/mailman/commands/eml_membership.py
=====================================
@@ -112,7 +112,8 @@ other than the sender of the command.
             print('Invalid email address: {}'.format(e), file=results)
             return ContinueProcessing.yes
         try:
-            ISubscriptionManager(mlist).register(subscriber)
+            ISubscriptionManager(mlist).register(subscriber,
+                                                 delivery_mode=delivery_mode)
         except (AlreadySubscribedError, InvalidEmailAddressError,
                 MembershipIsBannedError) as e:
             print(str(e), file=results)


=====================================
src/mailman/commands/tests/test_eml_membership.py
=====================================
@@ -24,6 +24,7 @@ from mailman.commands.eml_membership import Join, Leave
 from mailman.email.message import Message
 from mailman.interfaces.bans import IBanManager
 from mailman.interfaces.mailinglist import SubscriptionPolicy
+from mailman.interfaces.member import DeliveryMode
 from mailman.interfaces.pending import IPendings
 from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
@@ -100,6 +101,24 @@ class TestJoin(unittest.TestCase):
         self.assertIn('Confirmation email sent to a...@example.com',
                       str(results))
 
+    def test_join_digest_works(self):
+        # Subscribe a member to digest via join and verify it works.
+        # Set things so the subscribe works now.
+        self._mlist.subscription_policy = SubscriptionPolicy.open
+        # Create a verified address for Anne.
+        user = getUtility(IUserManager).make_user('a...@example.com', 'Anne')
+        address = user.addresses[0]
+        address.verified_on = address.registered_on
+        msg = Message()
+        msg['From'] = 'a...@example.com'
+        results = Results()
+        self._command.process(self._mlist, msg, {}, ('digest=mime',), results)
+        # Anne is a member.
+        members = list(self._mlist.members.members)
+        self.assertEqual(1, len(members))
+        self.assertEqual('a...@example.com', members[0].address.email)
+        self.assertEqual(DeliveryMode.mime_digests, members[0].delivery_mode)
+
     def test_join_other(self):
         # Subscribe a different address via join.
         msg = Message()


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -19,6 +19,8 @@ Bugs
 ----
 * Require aiosmtpd >= 1.4.1 to allow address local parts longer than 64 bytes
   in the lmtp runner.  (Closes #836)
+* The email join command now honors the digest=<no|mime|plain> option.
+  (Closes #19)
 
 Command line
 ------------


=====================================
src/mailman/runners/tests/test_join.py
=====================================
@@ -196,7 +196,6 @@ join digest=no
         self.assertEqual(anne.delivery_mode, DeliveryMode.regular)
 
     # LP: #1444184 - digest=mime is not currently supported.
-    @unittest.expectedFailure
     def test_join_with_mime_digests(self):
         # Test the digest=mime argument to the join command.
         msg = mfs("""\
@@ -212,7 +211,6 @@ join digest=mime
         self.assertEqual(anne.delivery_mode, DeliveryMode.mime_digests)
 
     # LP: #1444184 - digest=mime is not currently supported.
-    @unittest.expectedFailure
     def test_join_with_plain_digests(self):
         # Test the digest=mime argument to the join command.
         msg = mfs("""\



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/1e24fa89ddf4750993ec232b7f03afe054b39d31...b7d2493d50f5183ea8a1d9382e8fc211599e98e1

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