Make events tests independent of LOGIN_URL

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

View file

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