32 lines
668 B
Python
32 lines
668 B
Python
import pytest
|
|
from decimal import Decimal
|
|
from expenses.models import Account, Category
|
|
|
|
|
|
@pytest.fixture
|
|
def user(db, django_user_model):
|
|
return django_user_model.objects.create_user(
|
|
username="tester", password="testpass123"
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def auth_client(client, user):
|
|
client.login(username=user.username, password="testpass123")
|
|
return client
|
|
|
|
|
|
@pytest.fixture
|
|
def account(user):
|
|
return Account.objects.create(
|
|
owner=user,
|
|
name="Cuenta principal",
|
|
initial_balance=Decimal("0"),
|
|
active=True,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def category(user):
|
|
return Category.objects.create(owner=user, name="General")
|