From 753dc0710d0324cebdd4a0f88b3ab3114e6fefdd Mon Sep 17 00:00:00 2001 From: Tom Hodder Date: Sat, 3 Aug 2024 06:24:59 +0100 Subject: [PATCH 1/2] move check into block with accrue==True check --- django_ledger/tests/test_bill.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/django_ledger/tests/test_bill.py b/django_ledger/tests/test_bill.py index a4b7fa3c5..70d60a912 100644 --- a/django_ledger/tests/test_bill.py +++ b/django_ledger/tests/test_bill.py @@ -366,14 +366,13 @@ def test_bill_detail(self): # amount paid is shown self.assertContains(bill_detail_response, 'id="djl-bill-detail-amount-paid"') - # amount owed is shown - self.assertContains(bill_detail_response, 'id="djl-bill-detail-amount-owed"') - if not bill_model.accrue: # amount prepaid is not shown self.assertNotContains(bill_detail_response, ' id="djl-bill-detail-amount-prepaid"') # amount unearned is not shown self.assertNotContains(bill_detail_response, ' id="djl-bill-detail-amount-unearned"') + # amount owed is shown + self.assertContains(bill_detail_response, 'id="djl-bill-detail-amount-owed"') else: # amount prepaid is shown From 45fb0fae003beef19f7d374af2bd8984815a788e Mon Sep 17 00:00:00 2001 From: Tom Hodder Date: Sat, 3 Aug 2024 08:11:17 +0100 Subject: [PATCH 2/2] fix for other test not throwing --- django_ledger/tests/test_transactions.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/django_ledger/tests/test_transactions.py b/django_ledger/tests/test_transactions.py index 7fd20555f..e73f45571 100644 --- a/django_ledger/tests/test_transactions.py +++ b/django_ledger/tests/test_transactions.py @@ -68,11 +68,13 @@ def test_blank_data(self): self.assertFalse(form.is_valid(), msg='Form without data is supposed to be invalid') def test_invalid_account(self): - with self.assertRaises(ObjectDoesNotExist): - form = TransactionModelForm({ - 'account': 'Asset', - }) - form.is_valid() + form = TransactionModelForm({ + 'account': 'Asset', + 'tx_type': 'debit', + 'amount': Decimal(randint(10000, 99999)), + 'description': 'Bought Something Else ...' + }) + self.assertIn('“Asset” is not a valid UUID.', form.errors.as_text()) class TransactionModelFormSetTest(DjangoLedgerBaseTest):