Created
October 20, 2010 23:24
-
-
Save dickbrouwer/637570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from django.utils.importlib import import_module | |
from django.http import HttpRequest | |
from django.conf import settings | |
class SampleTest(TestCase): | |
def setUp(self): | |
# Create mock request object with session key | |
engine = import_module(settings.SESSION_ENGINE) | |
request = HttpRequest() | |
request.session = engine.SessionStore() | |
request.session['somekey'] = 'somevalue' | |
request.session.session_key = 'session_key_from_model_object?' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment