Fix test suite failures

This commit is contained in:
Raphael Michel
2020-11-01 15:43:57 +01:00
parent 6052895ada
commit fb92676aee
3 changed files with 6 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ from urllib.parse import urlsplit
import pytz
from django.conf import settings
from django.http import HttpRequest, HttpResponse, Http404
from django.http import Http404, HttpRequest, HttpResponse
from django.middleware.common import CommonMiddleware
from django.urls import get_script_prefix
from django.utils import timezone, translation

View File

@@ -115,9 +115,9 @@ def test_ignore_outside_api(token_client, organizer):
resp = token_client.post('/control/login'.format(organizer.slug),
PAYLOAD, format='json', HTTP_X_IDEMPOTENCY_KEY='foo')
assert resp.status_code == 200
resp = token_client.post('/control/invalid'.format(organizer.slug),
resp = token_client.post('/control/invalid/'.format(organizer.slug),
PAYLOAD, format='json', HTTP_X_IDEMPOTENCY_KEY='foo')
assert resp.status_code == 301
assert resp.status_code == 302
@pytest.fixture

View File

@@ -783,7 +783,7 @@ def test_impersonate(user, client):
response = client.get('/control/global/settings/')
assert response.status_code == 403
response = client.get('/control/')
response = client.post('/control/users/impersonate/stop', follow=True)
response = client.post('/control/users/impersonate/stop/', follow=True)
assert b'dummy@' in response.content
assert b'dummy2@' not in response.content
response = client.get('/control/global/settings/')
@@ -825,7 +825,8 @@ def test_staff_session(user, client):
assert response['Location'] == '/control/'
response = client.get('/control/global/settings/')
assert response.status_code == 200
client.post('/control/sudo/stop', follow=True)
response = client.get('/control/sudo/stop/', follow=True)
assert response.status_code == 200
response = client.get('/control/global/settings/')
assert response.status_code == 302
assert user.staffsession_set.last().logs.filter(url='/control/global/settings/').exists()