mirror of
https://github.com/ae-utbm/sith.git
synced 2025-04-16 02:50:22 +00:00
Use assertRedirects for test_not_authorized
This commit is contained in:
parent
31575d0b64
commit
d8be9a62b5
@ -4,6 +4,7 @@ import pytest
|
|||||||
from django.test import Client
|
from django.test import Client
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from model_bakery import baker
|
from model_bakery import baker
|
||||||
|
from pytest_django.asserts import assertRedirects
|
||||||
|
|
||||||
from core.baker_recipes import subscriber_user
|
from core.baker_recipes import subscriber_user
|
||||||
from core.models import User
|
from core.models import User
|
||||||
@ -29,8 +30,10 @@ class TestBillingInfo:
|
|||||||
reverse("eboutic:billing_infos"),
|
reverse("eboutic:billing_infos"),
|
||||||
payload,
|
payload,
|
||||||
)
|
)
|
||||||
assert response.status_code == 302
|
assertRedirects(
|
||||||
assert response["Location"].startswith(reverse("core:login"))
|
response,
|
||||||
|
reverse("core:login", query={"next": reverse("eboutic:billing_infos")}),
|
||||||
|
)
|
||||||
|
|
||||||
def test_edit_infos(self, client: Client, payload: dict[str, str]):
|
def test_edit_infos(self, client: Client, payload: dict[str, str]):
|
||||||
user = subscriber_user.make()
|
user = subscriber_user.make()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user