created test for income
This commit is contained in:
parent
618b0d9484
commit
de33e5db03
26
expenses_manager/expenses/tests/test_income.py
Normal file
26
expenses_manager/expenses/tests/test_income.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import pytest
|
||||||
|
from datetime import date
|
||||||
|
from decimal import Decimal
|
||||||
|
from django.urls import reverse
|
||||||
|
from expenses.models import Income, Account
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
def test_income_increases_account_balance(client, django_user_model):
|
||||||
|
user = django_user_model.objects.create_user(
|
||||||
|
username='test',
|
||||||
|
password='1234'
|
||||||
|
)
|
||||||
|
client.login(username='test', password='1234')
|
||||||
|
|
||||||
|
general_account = Account.objects.create(name='General', owner=user, initial_balance=1000, active=True)
|
||||||
|
|
||||||
|
Income.objects.create(
|
||||||
|
owner=user,
|
||||||
|
account=general_account,
|
||||||
|
amount=500,
|
||||||
|
name='Nomina enero',
|
||||||
|
date=date.today(),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert general_account.current_balance() == 1500
|
||||||
Loading…
Reference in New Issue
Block a user