You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Schwab <sn...@caimito.net> on 2009/12/30 01:23:06 UTC
Access to session when testing with PageTester?
In another thread I read that the HTTP session is simulated by PageTester. In
the other thread someone showed that you can get the ApplicationStateManager
and use @SessionState objects.
I'm writing a test that needs to set an attribute to the session so that
security code can access that attribute. The security code looks like this:
AuthenticationToken token = (AuthenticationToken)
requestGlobals.getRequest().getSession(true).getAttribute(AUTHENTICATION_TOKEN)
and is inside a service that gets the RequestGlobals injected via its
constructor.
Can I get access to the session and set an attribute when using PageTester?
I've tried:
RequestGlobals requestGlobals = tester.getService(RequestGlobals.class) ;
but requestGlobals.getRequest() and requestGlobals.getHTTPServletRequest()
both return null.
Thanks for helping out.
Stephan
-----
--
http://www.caimito.net - Caimito One Team - Agile Collaboration and Planning
tool
http://www.stephan-schwab.com - Personal blog
http://code.google.com/p/tapestry-sesame - Authentication extension for
Tapestry 5
--
View this message in context: http://old.nabble.com/Access-to-session-when-testing-with-PageTester--tp26962385p26962385.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org