phase2: add modular apps, auth scaffolding, and base template routing
This commit is contained in:
23
tests/test_auth.py
Normal file
23
tests/test_auth.py
Normal file
@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_signup_creates_user(client):
|
||||
payload = {
|
||||
"username": "scout1",
|
||||
"email": "scout1@example.com",
|
||||
"password1": "StrongPass12345",
|
||||
"password2": "StrongPass12345",
|
||||
}
|
||||
response = client.post(reverse("users:signup"), data=payload)
|
||||
assert response.status_code == 302
|
||||
assert User.objects.filter(username="scout1").exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dashboard_requires_authentication(client):
|
||||
response = client.get(reverse("core:dashboard"))
|
||||
assert response.status_code == 302
|
||||
assert reverse("users:login") in response.url
|
||||
@ -4,6 +4,6 @@ from django.urls import reverse
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_health_endpoint(client):
|
||||
response = client.get(reverse("health"))
|
||||
response = client.get(reverse("core:health"))
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "ok"
|
||||
|
||||
Reference in New Issue
Block a user