Refs #654 -- API: Writable invoice operations (#886)

* Invoices

* Update invoices.rst
This commit is contained in:
Raphael Michel
2018-04-29 14:29:03 +02:00
committed by GitHub
parent 6f30ecb365
commit b2f92acbf6
4 changed files with 131 additions and 2 deletions

View File

@@ -430,6 +430,33 @@ def test_invoice_detail(token_client, organizer, event, invoice):
assert res == resp.data
@pytest.mark.django_db
def test_invoice_regenerate(token_client, organizer, event, invoice):
InvoiceAddress.objects.filter(order=invoice.order).update(company="ACME Ltd")
resp = token_client.post('/api/v1/organizers/{}/events/{}/invoices/{}/regenerate/'.format(
organizer.slug, event.slug, invoice.number
))
assert resp.status_code == 204
invoice.refresh_from_db()
assert "ACME Ltd" in invoice.invoice_to
@pytest.mark.django_db
def test_invoice_reissue(token_client, organizer, event, invoice):
InvoiceAddress.objects.filter(order=invoice.order).update(company="ACME Ltd")
resp = token_client.post('/api/v1/organizers/{}/events/{}/invoices/{}/reissue/'.format(
organizer.slug, event.slug, invoice.number
))
assert resp.status_code == 204
invoice.refresh_from_db()
assert "ACME Ltd" not in invoice.invoice_to
assert invoice.order.invoices.count() == 3
invoice = invoice.order.invoices.last()
assert "ACME Ltd" in invoice.invoice_to
@pytest.mark.django_db
def test_order_mark_paid_pending(token_client, organizer, event, order):
resp = token_client.post(