Ok, I found the problem was in web.config.session_parameters.cookie_domain, 
it should be empty to be used in tests.

On Thursday, September 20, 2012 8:11:08 PM UTC+4, Andrey Kuzmin wrote:
>
> I tried to narrow down the case, and it appears something is wrong with my 
> app, because this works:
>
> import web
> web.config.debug = False
>
> urls = '/', 'SetValue', '/getvalue', 'GetValue'
>
> app = web.application(urls, globals())
> store = web.session.DiskStore('sessions')
> session = web.session.Session(app, store)
>
> class SetValue:
>     def GET(self):
>         web.setcookie("param", "some-kind-of-cookie-value")
>         session.param = "some-kind-of-session-value"
>         raise web.seeother("/getvalue")
>         
> class GetValue:
>     def GET(self):
>         return "Got cookie value: " + web.cookies().param + "\n" + \
>             "And session value: " + session.param
>
> if __name__ == "__main__":
>     b = app.browser()
>     b.open("/")
>     assert b.path == "/getvalue"
>     assert "some-kind-of-cookie-value" in b.get_text()
>     assert "some-kind-of-session-value" in b.get_text()
>
> On Thursday, September 20, 2012 7:59:58 PM UTC+4, Tomas Schertel wrote:
>>
>> How about this become a feature request?
>> It would be nice to use web.py components to test web.py applications :)
>>
>> On Thursday, 20 September 2012 10:47:37 UTC-3, Andrey Kuzmin wrote:
>>>
>>> Hi, I want to use app.browser to test my web.py app.
>>>
>>> The problem is that session is not kept between requests.
>>>
>>> I checked web.cookies() and they are empty.
>>>
>>> How to make app.browser set and retrieve cookies from webpy app?
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/59iJ2raZz0YJ.
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/webpy?hl=en.

Reply via email to