Hello, Ryan.

Indeed it should be "302" instead of "200". I'll fix it now. :)

BTW, here you have a full example with Pylons:
https://bitbucket.org/Gustavo/whatpylonsproject/src/tip/pylonssecuredapp/tests/functional/test_authn.py

Cheers.

 - Gustavo.

Ryan said:
> Hello,
> 
> I am following the
> http://code.gustavonarea.net/repoze.who-testutil/HowTo/TestingAuthenticatio
> n.htmlhow-to and trying to write a passing test based on the
> "test_voluntary_login" example:
> 
> def test_voluntary_login(self):
>     """Voluntary logins should work perfectly"""
>     # Requesting the login form:
>     login_page = self.app.get('/login', status=200)
>     login_form = login_page.form
>     login_form['login'] = 'username'
>     login_form['password'] = 'password'
>     # Submitting the login form:
>     login_handler = login_form.submit(status=302)
>     assert login_handler.location == 'http://localhost/'
>     # Checking that the user was correctly authenticated:
>     initial_page = login_handler.follow(status=200)
>     assert 'auth_tkt' in initial_page.request.cookies, \
>            "Session cookie wasn't defined: %s" %
> initial_page.request.cookies
> 
> I'm using the repoze.what Quickstart plugin (just easy installed the most
> recent version) with Pylons 1.0 and this test fails
> because login_handler.follow(status=200) is 302'ing.
> 
> When I leave my test environment and do my own user testing in my
> development environment, everything works fine. I've also made certain that
> I do in fact have the correct username and password I am trying to
> authenticate against in my database.
> 
> Can anyone confirm or deny that this example works in Pylons? Any help on
> how I can get it to pass?
> 
> Thanks!
> Ryan
-- 
Gustavo Narea <xri://=Gustavo>.
| Tech blog: =Gustavo/(+blog)/tech  ~  About me: =Gustavo/about |
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to