diff --git a/testapp/testapp/testmain/tests/test_webservices.py b/testapp/testapp/testmain/tests/test_webservices.py index 218d7eeb..ddf5df0f 100644 --- a/testapp/testapp/testmain/tests/test_webservices.py +++ b/testapp/testapp/testmain/tests/test_webservices.py @@ -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) diff --git a/tox.ini b/tox.ini index 7a08033d..12fcb065 100644 --- a/tox.ini +++ b/tox.ini @@ -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" @@ -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