2 passed in 0.82s, 32% coverage

This commit is contained in:
Oussama Jarrousse
2023-12-26 17:33:21 +01:00
parent 41256cc76d
commit 6ae4c2508c
5 changed files with 113 additions and 7 deletions

View File

@@ -1,2 +1,25 @@
import pytest
from django.urls import reverse
@pytest.mark.django_db
def test_index_unauthenticated(client):
url = reverse("mfa_home")
response = client.get(url)
assert response is not None
assert response.status_code == 302
assert response.url=="/accounts/login/?next=/"
@pytest.mark.django_db
def test_index_authenticated(client, authenticated_user):
url = reverse("mfa_home")
response = client.get(url)
assert response is not None
assert response.status_code == 200
assert isinstance(response.templates, list)
assert len(response.templates) == 4
for template in response.templates:
assert template.name in ["modal.html", "base.html", "mfa_base.html", "MFA.html"]