On Sat, Jun 28, 2008 at 7:19 AM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > > > On Jun 28, 7:18 am, "Shannon -jj Behrens" <[EMAIL PROTECTED]> wrote: > >> * Use one action to put something into the session and then another >> to make use of the session. It's a work flow. > > I've always thought that Pylons should have something that does that.
Well, JJ is right in a way. The session is supposed to hold state between web requests. So it makes sense that you'd set it up via web requests. Just like an application that requires login; you have to do the login request at the beginning of each test. But I can also see the point of giving Pylons some premade session data, like a test with premade database data. In Mechanize you can precreate a CookieJar and seed it with cookies, and pass that to your fake browser object. You can also save the cookie jar to a file and reuse it later. You can probably do something similar with Pylons. Give it a premade Beaker instance stuffed with a session, and seed the test "browser" with the same session ID. It may need a couple API changes somewhere to make it more convenient. For my screen scraper experiments I have a custom subclass of Mechanize that makes it easier to build a stuffed cookie jar. Perhaps the Beaker middleware could be taught to look for a premade Beaker instance somewhere before creating one. I'm just not sure where that "somewhere" would be. If self.app.get() is the same as paste.fixture.TestApp.get(), there's an 'extra_environ' arg to pass variables to the (CGI?|WSGI?) environment. If you stuffed something there (a Beaker instance?) and the Beaker middleware found it in the environment, perhaps it could just use it. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
