I have the following test method, where I add a test user to the database, 
then with a DummyRequest I call my login view, then I assert the 
authenticated_userid is what I think it should be. However it returns None.

 def test_login(self):
        self.config = testing.setUp()
        self.config.include('mymodule')
        self.config.add_route('home', '/')

        user = UserFactory.build(id='testid', post__password='testpassword')
        DBSession.add(user)
        self._transaction.commit()

        request = testing.DummyRequest(post={'id': 'testid', 'password': 
'testpassword'})
        view = views.login(request)

        assert authenticated_userid(request) is 'testid'  # FAILS, 
returning None instead of 'testid'




The last lines of my views.login function are here.

                print(user.id)  # Prints 'testid' as expected, so the user 
is being retrieved correctly from the database
                headers = remember(request, user.id)
                return HTTPFound(location=next, headers=headers)




In my module's includeme function I have:

def includeme(config):
    authz_policy = ACLAuthorizationPolicy()
    config.set_authorization_policy(authz_policy)
    authn_policy = AuthTktAuthenticationPolicy('....', hashalg='sha512')
    config.set_authentication_policy(authn_policy)



Any idea what I'm doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to