launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25983
[Merge] ~cjwatson/launchpad:py3-testopenid-future-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-testopenid-future-imports into launchpad:master.
Commit message:
Convert lp.testopenid doctests to __future__ imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396109
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-testopenid-future-imports into launchpad:master.
diff --git a/lib/lp/testopenid/stories/basics.txt b/lib/lp/testopenid/stories/basics.txt
index 6672e40..0368d65 100644
--- a/lib/lp/testopenid/stories/basics.txt
+++ b/lib/lp/testopenid/stories/basics.txt
@@ -15,7 +15,7 @@ that the consumer is being fed the correct replies, we use a view that
renders the parameters in the response in an easily testable format.
>>> anon_browser.open('http://testopenid.test/+echo?foo=bar')
- >>> print anon_browser.contents
+ >>> print(anon_browser.contents)
Request method: GET
foo:bar
@@ -34,12 +34,12 @@ POST request.
... 'http://testopenid.test/+openid', data=urlencode({
... 'openid.mode': 'associate',
... 'openid.assoc_type': 'HMAC-SHA1'}))
- >>> print anon_browser.headers
+ >>> print(anon_browser.headers)
Status: 200 Ok
...
Content-Type: text/plain;charset=utf-8
...
- >>> print anon_browser.contents
+ >>> print(anon_browser.contents)
assoc_handle:{HMAC-SHA1}{...}{...}
assoc_type:HMAC-SHA1
expires_in:1209...
@@ -66,16 +66,16 @@ completing the OpenID request:
... 'openid.return_to': 'http://testopenid.test/+echo',
... })
>>> user_browser.open('http://testopenid.test/+openid?%s' % args)
- >>> print user_browser.url
+ >>> print(user_browser.url)
http://testopenid.test/+openid?...
- >>> print user_browser.title
+ >>> print(user_browser.title)
Login
>>> user_browser.getControl(name='field.email').value = 'mark@xxxxxxxxxxx'
>>> user_browser.getControl('Continue').click()
- >>> print user_browser.url
+ >>> print(user_browser.url)
http://testopenid.test/+echo?...
- >>> print user_browser.contents
+ >>> print(user_browser.contents)
Request method: GET
openid.assoc_handle:...
openid.identity:http://testopenid.test/+id/mark_oid
@@ -111,7 +111,7 @@ check_authentication will fail.
... 'openid.return_to': 'http://testopenid.test/+echo',
... })
>>> user_browser.open('http://testopenid.test/+openid?%s' % args)
- >>> print user_browser.contents
+ >>> print(user_browser.contents)
is_valid:false
<BLANKLINE>
@@ -128,7 +128,7 @@ fields that were signed.
>>> user_browser.open('http://testopenid.test/+openid?%s' % args)
>>> user_browser.getControl(name='field.email').value = 'mark@xxxxxxxxxxx'
>>> user_browser.getControl('Continue').click()
- >>> print user_browser.contents
+ >>> print(user_browser.contents)
Request method: GET
openid.assoc_handle:...
openid.identity:http://testopenid.test/+id/mark_oid
@@ -156,6 +156,6 @@ fields that were signed.
>>> args = urlencode(message)
>>> user_browser.open('http://testopenid.test/+openid', args)
- >>> print user_browser.contents
+ >>> print(user_browser.contents)
is_valid:true
<BLANKLINE>
diff --git a/lib/lp/testopenid/stories/logging-in.txt b/lib/lp/testopenid/stories/logging-in.txt
index dc3089e..ef0d17c 100644
--- a/lib/lp/testopenid/stories/logging-in.txt
+++ b/lib/lp/testopenid/stories/logging-in.txt
@@ -30,17 +30,17 @@ checkid_setup request, sending the user to Launchpad:
At this point, the user is presented with a login form:
- >>> print browser.title
+ >>> print(browser.title)
Login
If the email address isn't registered, an error is shown:
>>> browser.getControl(name='field.email').value = 'does@not.exist'
>>> browser.getControl('Continue').click()
- >>> print browser.title
+ >>> print(browser.title)
Login
>>> for tag in find_tags_by_class(browser.contents, 'error'):
- ... print extract_text(tag)
+ ... print(extract_text(tag))
There is 1 error.
Unknown email address.
@@ -49,12 +49,12 @@ returned to the relying party, with the user's identity URL:
>>> browser.getControl(name='field.email').value = 'mark@xxxxxxxxxxx'
>>> browser.getControl('Continue').click()
- >>> print browser.url
+ >>> print(browser.url)
http://testopenid.test/+echo?...
>>> info = complete_from_browser(consumer, browser)
- >>> print info.status
+ >>> print(info.status)
success
- >>> print info.endpoint.claimed_id
+ >>> print(info.endpoint.claimed_id)
http://testopenid.test/+id/mark_oid
# Clean up the changes we did to the openid module.
diff --git a/lib/lp/testopenid/stories/tests.py b/lib/lp/testopenid/stories/tests.py
index 0c0d88e..f1d9e83 100644
--- a/lib/lp/testopenid/stories/tests.py
+++ b/lib/lp/testopenid/stories/tests.py
@@ -6,7 +6,10 @@ import unittest
import scandir
-from lp.testing.pages import PageTestSuite
+from lp.testing.pages import (
+ PageTestSuite,
+ setUpGlobs,
+ )
here = os.path.dirname(os.path.realpath(__file__))
@@ -18,8 +21,10 @@ def test_suite():
if not entry.name.startswith('.') and entry.is_dir())
suite = unittest.TestSuite()
- suite.addTest(PageTestSuite('.'))
+ suite.addTest(PageTestSuite(
+ '.', setUp=lambda test: setUpGlobs(test, future=True)))
for storydir in stories:
- suite.addTest(PageTestSuite(storydir))
+ suite.addTest(PageTestSuite(
+ storydir, setUp=lambda test: setUpGlobs(test, future=True)))
return suite