Commit 9f92054c by Ned Batchelder

Fix tests to work with Django 1.4.22

The 1.4.22 security fix makes it so that empty sessions are not written.
To keep the tests working, we now log in the user, so that some data is
saved to the session.
parent c3234c1c
...@@ -10,6 +10,8 @@ from django.test.client import Client ...@@ -10,6 +10,8 @@ from django.test.client import Client
from django.test.utils import override_settings from django.test.utils import override_settings
import unittest import unittest
from student.tests.factories import UserFactory
# NOTE: We set SESSION_SAVE_EVERY_REQUEST to True in order to make sure # NOTE: We set SESSION_SAVE_EVERY_REQUEST to True in order to make sure
# Sessions are always started on every request # Sessions are always started on every request
...@@ -22,8 +24,13 @@ class MicroSiteSessionCookieTests(TestCase): ...@@ -22,8 +24,13 @@ class MicroSiteSessionCookieTests(TestCase):
def setUp(self): def setUp(self):
super(MicroSiteSessionCookieTests, self).setUp() super(MicroSiteSessionCookieTests, self).setUp()
# create a test client # Create a test client, and log it in so that it will save some session
# data.
self.user = UserFactory.create()
self.user.set_password('password')
self.user.save()
self.client = Client() self.client = Client()
self.client.login(username=self.user.username, password="password")
def test_session_cookie_domain_no_microsite(self): def test_session_cookie_domain_no_microsite(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment