12
Jan
How to set session variables in Django unit tests.
This was super non-obvious, and I lifted code from a couple of different places. If you’ve got Django view code that gets & sets session values, you’ll want to test it properly, and the standard “self.client” from Django’s TestCase doesn’t really give you a usable session. So, here’s the method I’m using: def stuff_session(client, dictionary): [...]
Continue Reading →