#34327: Test client session does not work as described when using signed cookie engine -------------------------------------+------------------------------------- Reporter: Sergei | Owner: nobody Type: Bug | Status: new Component: Testing framework | Version: dev Severity: Normal | Resolution: Keywords: session | Triage Stage: signed_cookies | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak): Replying to [ticket:34327 Sergei]: > The following snippet from [https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.Client.session the documentation] does not work when using `django.contrib.sessions.backends.signed_cookies`: This is not an universal snippet intended to work with all kind of built- in and 3-party session engines. It's only an example of how the session can be modified. We could clarify this with: {{{#!diff diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index 85652095a8..94d11197ca 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -688,7 +688,8 @@ access these properties as part of a test condition. To modify the session and then save it, it must be stored in a variable first (because a new ``SessionStore`` is created every time this property - is accessed):: + is accessed). For example, if you use + ``'django.contrib.sessions.backends.db'`` engine (the default): def test_something(self): session = self.client.session }}} What do you think? -- Ticket URL: <https://code.djangoproject.com/ticket/34327#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/010701864aac3d94-b94c2e77-c17c-4a61-8ec0-981198f9359a-000000%40eu-central-1.amazonses.com.