On Wednesday 22 August 2007, Titus Brown wrote:
> On Wed, Aug 22, 2007 at 03:27:03PM -0500, Eli Carter wrote:
> -> With -latest, the find("logged in as %s" % username), is looking at a
page
> -> consisting of 'Redirecting...' [2].
> ->
> -> What am I doing wrong here?
>
> Hi, Eli,
>
> what's going on with the HTTP codes? Can you send me the results of
> 'debug http 1'?
Sorry for the delay getting back to you on this.
I reduced the set of tests to one failing test.[1]
I patched twill-latest to display the content of the page when .find()
(or .notfind()) fails.[2]
I called twill.commands.debug('http', 1) shortly before the problematic part.
[3]
The output from that is attached.
The testcase adds auth for 'user' (it had previously added auth for 'admin'),
goes to http://localhost:port, follows the 'Login' link, and expects to be
redirected back to http://localhost:port, where it will find the
string "logged in as user". Instead, what I'm seeing is the new page
consists of "Redirecting...".
This worked as I expected in 0.9b1.
Any pointers to what I'm doing wrong would be appreciated.
Thanks,
Eli
[1] RegressionTestTicket4630a
[2] against twill-latest
--- twill-latest/twill/commands.py 2007-08-22 03:05:09.000000000 -0500
+++ twill-latest.ejc/twill/commands.py 2007-08-24 09:53:28.000000000 -0500
@@ -231,7 +231,7 @@
m = regexp.search(page)
if not m:
- raise TwillAssertionError("no match to '%s'" % (what,))
+ raise TwillAssertionError("no match to '%s'" % (what,), page)
if m.groups():
match_str = m.group(1)
@@ -251,7 +251,7 @@
page = browser.get_html()
if regexp.search(page):
- raise TwillAssertionError("match to '%s'" % (what,))
+ raise TwillAssertionError("match to '%s'" % (what,), page)
def back():
"""
[3] tc.debug('http', 1) just before this line:
http://trac.edgewall.org/browser/sandbox/testing/trac/tests/functional.py#L201
and tc.debug('http', 0) just after that line. And only for the failing case.
Test for regression of http://trac.edgewall.org/ticket/4630 a ... connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nHost: localhost:8035\r\nAccept: text/html; */*\r\nConnection: close\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_session=713b03c6a741fc2ec5dc99f6\r\nReferer: http://localhost:8035/logout\r\n\r\n'
reply: 'HTTP/1.0 401 Unauthorized\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: WWW-Authenticate: Basic realm=""
connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nReferer: http://localhost:8035/logout\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_session=713b03c6a741fc2ec5dc99f6\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/logout
header: Content-Type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=ba31999de793c01116909ba6dd42b94b;
header: Set-Cookie: trac_session=713b03c6a741fc2ec5dc99f6; expires=Fri, 24-Aug-2007 15:23:48 GMT;
connect: (localhost, 8035)
send: 'GET /logout HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_auth=ba31999de793c01116909ba6dd42b94b\r\nReferer: http://localhost:8035/login\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/login
header: Content-Type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=; expires=Fri, 24-Aug-2007 12:37:08 GMT;
connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159\r\nReferer: http://localhost:8035/login\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/login
header: Content-Type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=9a1f688a8a2dec175af3e0097114fa5b;
connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_auth=9a1f688a8a2dec175af3e0097114fa5b\r\nReferer: http://localhost:8035/login\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/login
header: Content-Type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=8ca0c077f8277f29ae9f306e5ad91719;
connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_auth=8ca0c077f8277f29ae9f306e5ad91719\r\nReferer: http://localhost:8035/login\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/login
header: Content-Type: text/plain
header:FAIL
======================================================================
FAIL: Test for regression of http://trac.edgewall.org/ticket/4630 a
----------------------------------------------------------------------
Traceback (most recent call last):
File "./trac/tests/functional.py", line 760, in runTest
self._tester.login('user', 1)
File "./trac/tests/functional.py", line 212, in login
tc.find("logged in as %s" % username)
File "/home/eli/workflow/twill-latest.ejc/twill/commands.py", line 234, in find
raise TwillAssertionError("no match to '%s'" % (what,), page)
TwillAssertionError: ("no match to 'logged in as user'", 'Redirecting...')
----------------------------------------------------------------------
Ran 1 test in 7.129s
FAILED (failures=1)
Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=8a6da64963d12c13b810e041a34c8161;
connect: (localhost, 8035)
send: 'GET /login HTTP/1.1\r\nAccept-Encoding: identity\r\nCookie2: $Version="1"\r\nConnection: close\r\nAccept: text/html; */*\r\nHost: localhost:8035\r\nCookie: trac_form_token=6ccbb74cce3b10daf5cba159; trac_auth=8a6da64963d12c13b810e041a34c8161\r\nReferer: http://localhost:8035/login\r\nAuthorization: Basic dXNlcjp1c2Vy\r\n\r\n'
reply: 'HTTP/1.0 302 Found\r\n'
header: Server: tracd/0.11dev-r5692 Python/2.4.4
header: Date: Fri, 24 Aug 2007 15:23:48 GMT
header: Location: http://localhost:8035/login
header: Content-Type: text/plain
header: Pragma: no-cache
header: Cache-control: no-cache
header: Expires: Fri, 01 Jan 1999 00:00:00 GMT
header: Set-Cookie: trac_auth=83616a4eb48ebd9a428cf785cc09b274;
_______________________________________________
twill mailing list
[email protected]
http://lists.idyll.org/listinfo/twill