launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26532
[Merge] ~cjwatson/launchpad:py3-test-bad-ssh-key-data into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-bad-ssh-key-data into launchpad:master.
Commit message:
Fix test_new_raises_KeyAdditionError_on_bad_key_data for Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/399085
`twisted.conch.ssh.keys.Key.fromString` raises slightly different exceptions on Python 2 and 3.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-bad-ssh-key-data into launchpad:master.
diff --git a/lib/lp/registry/tests/test_ssh.py b/lib/lp/registry/tests/test_ssh.py
index 8cab72c..2f3e700 100644
--- a/lib/lp/registry/tests/test_ssh.py
+++ b/lib/lp/registry/tests/test_ssh.py
@@ -5,6 +5,8 @@
__metaclass__ = type
+import sys
+
from testtools.matchers import StartsWith
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -203,10 +205,14 @@ class TestSSHKeySet(TestCaseWithFactory):
keyset.new,
person, 'ssh-rsa badkeytext comment'
)
+ if sys.version_info[0] >= 3:
+ expected_message = "unknown blob type: b'\\xc7_'"
+ else:
+ expected_message = "unknown blob type: \\xc7_"
self.assertRaisesWithContent(
SSHKeyAdditionError,
"Invalid SSH key data: 'ssh-rsa asdfasdf comment' "
- "(unknown blob type: \\xc7_)",
+ "(%s)" % expected_message,
keyset.new,
person, 'ssh-rsa asdfasdf comment'
)