How to correctly unit test a Django session?

Django session behavior changes between the “standard” view code and the test code, making it unclear how test code is written for the sessions. As a result of this work, two relevant discussions on this issue can be obtained:

I am confused because both tickets have different ways to solve this problem, and they were both accepted. I suppose that means they have been fixed, and now the behavior is different. I also do not know which versions of these fixes apply.

If I write unit test in Django 1.0, how do I configure the session store for sessions in the same way as in a browser?

+3
source share
1 answer

I don’t quite understand what you mean by saying changes in behavior between the “standard” representation and the “test” code, maybe you should dwell on this in more detail.

but how to check the session, I think there are approaches.

  • you need to understand how a django session works, read the unit test for the session package that you used in your application. it is about understanding how the server side works.
  • you will probably need to capture a few conversations between the browser and the server (e.g. using FIREBUG)

: session_id, . (POST, GET, COOKIES, ).

, HTTP, , , , .

+1

Source: https://habr.com/ru/post/1739247/


All Articles