django-ledger icon indicating copy to clipboard operation
django-ledger copied to clipboard

couple of fixes for failing tests on develop

Open tolland opened this issue 1 year ago • 0 comments

FAIL: test_bill_detail (django_ledger.tests.test_bill.BillModelTests.test_bill_detail)

move check to inside the conditional to match the template for test_bill_detail

before:

FAIL: test_bill_detail (django_ledger.tests.test_bill.BillModelTests.test_bill_detail)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user1/git/django-ledger/django_ledger/tests/test_bill.py", line 370, in test_bill_detail
    self.assertContains(bill_detail_response, 'id="djl-bill-detail-amount-owed"')
  File "/home/user1/.local/share/virtualenvs/django-ledger-azuD17Ir/lib/python3.11/site-packages/django/test/testcases.py", line 537, in assertContains
    self.assertTrue(
AssertionError: False is not true : Couldn't find 'id="djl-bill-detail-amount-owed"' in response

after:

python manage.py test django_ledger.tests.test_bill.BillModelTests.test_bill_detail
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
08/03/2024 01:26:12 AM Populating Entity Testing Inc-665267...
.
----------------------------------------------------------------------
Ran 1 test in 9.889s

OK


FAIL: test_invalid_account (django_ledger.tests.test_transactions.TransactionModelFormTest.test_invalid_account)

Before:

$ python manage.py test django_ledger.tests.test_transactions.TransactionModelFormTest.test_invalid_account
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
08/03/2024 03:05:50 AM Populating Entity Testing Inc-365338...
F
======================================================================
FAIL: test_invalid_account (django_ledger.tests.test_transactions.TransactionModelFormTest.test_invalid_account)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user1/git/django-ledger/django_ledger/tests/test_transactions.py", line 71, in test_invalid_account
    with self.assertRaises(ObjectDoesNotExist):
AssertionError: ObjectDoesNotExist not raised

----------------------------------------------------------------------
Ran 1 test in 9.793s

FAILED (failures=1)

testing is failing because form validation never throws the exception mentioned.

After:

$ python manage.py test django_ledger.tests.test_transactions.TransactionModelFormTest.test_invalid_account
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
08/03/2024 03:08:27 AM Populating Entity Testing Inc-737980...
.
----------------------------------------------------------------------
Ran 1 test in 10.763s

OK

tolland avatar Aug 03 '24 05:08 tolland