Skip to content

Instantly share code, notes, and snippets.

View Thompsonmina's full-sized avatar
🏠
Working from home

Thompson Thompsonmina

🏠
Working from home
View GitHub Profile
@Thompsonmina
Thompsonmina / persistent_test_session.py
Created August 14, 2020 17:54 — forked from stephenmcd/persistent_test_session.py
Persistent Sessions in Django TestCase
"""
The Django test client implements the session API but doesn't persist values in it:
https://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs#django.test.client.Client.session
This Client subclass can be used to maintain a persistent session during test cases.
"""
from django.conf import settings
from django.test import TestCase