Thanks.
I've run the test in a django virtualenv, and it's working so I guess Django isn't broken...
But I've copied:
in tests.py
But I still get the error:
-- I've run the test in a django virtualenv, and it's working so I guess Django isn't broken...
But I've copied:
in tests.py
class TestDataMixin:
@classmethod
def setUpTestData(cls):
cls.u1 = User.objects.create_user(username='testclient', password='password')
cls.staff = User.objects.create_user(username='staff', password='password', is_staff=True)
class SessionTests(TestDataMixin, TestCase):
def test_session_initiale(self): # NOT WORKING
session = self.client.session
session['session_var'] = 'foo'
session.save()
response = self.client.get('/check_session/')
self.assertEqual(response.content, b'foo')
But I still get the error:
self.assertEqual(response.content, b'foo')
AssertionError: b'NO' != b'foo'
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/871c990a-2717-4c2f-848c-65ec6f128dad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment