Louis Erickson wrote on 05/13/2009 12:07 AM:

> Can I just generate the cookie and put it in the cookie store directly 
> before the query is made to the application?  I can generate the cookie 
> with the SSO library.  I don't see a way to do that through either test 
> tool.
> 

I'm coming in late on this thread, but can at least offer a "how I do
it" case.

Catalyst::Authentication::AuthTkt is a shim for Apache::AuthTkt, a
cookie-based SSO system. In order to test how the Session and
Authentication plugins interact, I hacked around how Catalyst::Test does
requests in order to preserve a session cookie over multiple requests.

You can see the AuthTkt tests here[0]. The my_request() function just
sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure
that's a Bad Way to Do It, but it works.

I would love to see some basic cookie features in Catalyst::Test, and if
I knew the Right Way to do it, I'd be happy to add code. I use
Catalyst::Test for most things. It is simple, comes with Catalyst so
there's no extra dep. I have used the Mech tests too, and Mech is cool.
But I like keeping my deps down where I can.

[0]
http://cpansearch.perl.org/src/KARMAN/Catalyst-Authentication-AuthTkt-0.10/t/01-authtkt.t

-- 
Peter Karman  .  [email protected]  .  http://peknet.com/


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to