Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion testapp/testapp/testmain/tests/test_webservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,20 @@ def test_validation_with_observations(self):
self.assertEqual(models.Observation.objects.count(), 1)
self.assertEqual(receipt.validation.observations.count(), 1)

def test_credit_note(self):
"""Test validating valid a credit note."""
# Create an invoice (code=6) and validate it...
invoice = self._good_receipt()

# TODO: Test receipts with related_receipts
errs = models.Receipt.objects.filter(pk=invoice.pk).validate()
self.assertEqual(len(errs), 0)
self.assertEqual(models.ReceiptValidation.objects.count(), 1)

# Now create a credit note (code=8) and validate it...
credit = self._good_receipt()
credit.receipt_type = factories.ReceiptTypeFactory(code=8)
credit.related_receipts.set([invoice])

errs = models.Receipt.objects.filter(pk=credit.pk).validate()
self.assertEqual(len(errs), 0)
self.assertEqual(models.ReceiptValidation.objects.count(), 2)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envlist =
skip_install = True
deps = pipenv
commands =
pipenv install --dev --skip-lock
pipenv --bare install --dev --skip-lock
postgres: pip install -e .[postgres]
mysql: pip install -e .[mysql]
django21: pip install "Django>=2.1,<2.2"
Expand All @@ -23,7 +23,7 @@ passenv =
[testenv:live]
deps = pipenv
commands =
pipenv install --dev
pipenv --bare install --dev
coverage run testapp/manage.py test testapp
coverage report

Expand Down