[Django]-Django testing stored session data in tests

51👍

According to the docs:

from django.test import TestCase

class SimpleTest(TestCase):
    def test_details(self):
        # Issue a GET request.
        self.client.get('/customer/details/')
        session = self.client.session
        self.assertEqual(session["somekey"], "test")

Leave a comment