24 lines
707 B
Python
24 lines
707 B
Python
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
|