Make events tests independent of LOGIN_URL

This commit is contained in:
Martin Pépin 2020-05-15 20:37:37 +02:00
parent 25b603d667
commit 3a34ab4462
No known key found for this signature in database
GPG key ID: E7520278B1774448

View file

@ -1,5 +1,6 @@
from unittest import mock from unittest import mock
from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.test import Client, TestCase from django.test import Client, TestCase
@ -59,9 +60,8 @@ class CSVExportAccessTest(MessagePatch, TestCase):
def test_anonymous(self): def test_anonymous(self):
client = Client() client = Client()
r = client.get(self.url) r = client.get(self.url)
self.assertRedirects( login_url = "{}?next={}".format(reverse(settings.LOGIN_URL), self.url)
r, "/login?next={}".format(self.url), fetch_redirect_response=False self.assertRedirects(r, login_url, fetch_redirect_response=False)
)
def test_unauthorised(self): def test_unauthorised(self):
client = Client() client = Client()