Files
website-v2/users/tests/fixtures.py
Lacey Williams Henschel 59a72c9a9a 👕 Linter
2023-02-15 14:44:28 -08:00

60 lines
1.2 KiB
Python

import pytest
from django.utils import timezone
from model_bakery import baker
@pytest.fixture
def user(db):
"""Regular website user"""
user = baker.make(
"users.User",
email="user@example.com",
first_name="Regular",
last_name="User",
last_login=timezone.now(),
image="static/img/fpo/user.png",
)
user.set_password("password")
user.save()
return user
@pytest.fixture
def staff_user(db):
"""Staff website user with access to the Django admin"""
user = baker.make(
"users.User",
email="staff@example.com",
first_name="Staff",
last_name="User",
last_login=timezone.now(),
is_staff=True,
image="static/img/fpo/user.png",
)
user.set_password("password")
user.save()
return user
@pytest.fixture
def super_user(db):
"""Superuser with access to everything"""
user = baker.make(
"users.User",
email="super@example.com",
first_name="Super",
last_name="User",
last_login=timezone.now(),
is_staff=True,
is_superuser=True,
image="static/img/fpo/user.png",
)
user.set_password("password")
user.save()
return user