launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26220
[Merge] ~cjwatson/launchpad:py3-test-weakly-authenticated-with-sig into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-weakly-authenticated-with-sig into launchpad:master.
Commit message:
Fix test_weakly_authenticated_with_sig
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397514
Python 3 doesn't let us clobber the SignedMessage.signature property.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-weakly-authenticated-with-sig into launchpad:master.
diff --git a/lib/lp/services/mail/tests/test_helpers.py b/lib/lp/services/mail/tests/test_helpers.py
index 0cf228e..b748143 100644
--- a/lib/lp/services/mail/tests/test_helpers.py
+++ b/lib/lp/services/mail/tests/test_helpers.py
@@ -4,6 +4,7 @@
__metaclass__ = type
from doctest import DocTestSuite
+from textwrap import dedent
import time
import unittest
@@ -186,8 +187,16 @@ class TestEnsureNotWeaklyAuthenticated(TestCaseWithFactory):
error.message)
def test_weakly_authenticated_with_sig(self):
- signed_msg = self.factory.makeSignedMessage()
- signed_msg.signature = 'fakesig'
+ body = dedent("""\
+ -----BEGIN PGP SIGNED MESSAGE-----
+
+ fakecontent
+ -----BEGIN PGP SIGNATURE-----
+
+ fakesig
+ -----END PGP SIGNATURE-----
+ """"")
+ signed_msg = self.factory.makeSignedMessage(body=body)
self._setWeakPrincipal()
error = self.assertRaises(
IncomingEmailError,