#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 Sergei):
Replying to [comment:2 Mariusz Felisiak]:
> What do you think?
Thanks for the suggestion! I guess it could be solved with documentation.
Then I think there is a need to explain what's going on. Maybe like this?
{{{#!diff
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index 85652095a8..b3deb2b377 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -695,6 +695,12 @@ access these properties as part of a test condition.
session['somekey'] = 'test'
session.save()
+ # if a particular session store changes session key on
modification
+ # (like signed cookie store does), it's required to update
the
+ # session key in cookies
+ from django.conf import settings
+ self.client.cookies[settings.SESSION_COOKIE_NAME] =
session.session_key
+
}}}
But I still think it's too much details spilling into a test, could be
handled internally in the `ClientMixin`, independent of a concrete store
implementation (it already does everything actually).
--
Ticket URL: <https://code.djangoproject.com/ticket/34327#comment:3>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701864c019065-aab7d6e9-e247-4f48-879b-f440422652e5-000000%40eu-central-1.amazonses.com.