Skip to content

Commit

Permalink
fix testing configuration for newer Django versions
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed May 11, 2022
1 parent 27fde95 commit 01b68d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion experiments/tests/test_webuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_transfer_enrollments(self):
# if the participant cache hasn't been wiped appropriately then the
# session experiment user will be impacted instead of the authenticated
# experiment user
ExperimentsRetentionMiddleware().process_response(request, HttpResponse())
ExperimentsRetentionMiddleware(request).process_response(request, HttpResponse())
self.assertIsNotNone(Enrollment.objects.all()[0].last_seen)


Expand Down
2 changes: 1 addition & 1 deletion experiments/tests/test_webuser_incorporate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _login(self):
def test_visit_incorporate(self):
alternative = participant(self.request).enroll(self.experiment.name, ['alternative'])

ExperimentsRetentionMiddleware().process_response(self.request, HttpResponse())
ExperimentsRetentionMiddleware(self.request).process_response(self.request, HttpResponse())

self.assertEqual(
dict(self.experiment_counter.participant_goal_frequencies(self.experiment,
Expand Down
7 changes: 5 additions & 2 deletions testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ def runtests():
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.messages',
'experiments',),
ROOT_URLCONF='experiments.tests.urls',
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware'
),
SECRET_KEY="foobarbaz",
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
Expand All @@ -36,6 +38,7 @@ def runtests():
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
Expand Down

0 comments on commit 01b68d6

Please sign in to comment.