Invoice addresses: Ask for a state in some countries (#1362)

* Invoice addresses: Ask for a state in some countries

* API, tests, noscript

* Fix shredder tests

* Add test for addresses with long state names
This commit is contained in:
Raphael Michel
2019-08-09 09:55:46 +02:00
committed by GitHub
parent 547f71aac6
commit d919605d79
19 changed files with 367 additions and 27 deletions

View File

@@ -171,6 +171,7 @@ def test_invoice_address_shredder(event, order):
data={
"data": [{"attendee_name": "Hans", "question_1": "Test"}],
"invoice_data": {"name": "Peter", "country": "DE", "is_business": False, "internal_reference": "",
"state": "",
"company": "ACME", "street": "Sesam Street", "city": "Sample City", "zipcode": "12345"}
}
)
@@ -189,6 +190,7 @@ def test_invoice_address_shredder(event, order):
'last_modified': ia.last_modified.isoformat().replace('+00:00', 'Z'),
'name': '',
'name_parts': {},
'state': '',
'street': '221B Baker Street',
'vat_id': '',
'vat_id_validated': False,
@@ -202,7 +204,7 @@ def test_invoice_address_shredder(event, order):
assert l1.parsed_data == {
"data": [{"attendee_name": "Hans", "question_1": "Test"}],
"invoice_data": {"name": "", "country": "", "is_business": False, "internal_reference": "", "company": "",
"street": "", "city": "", "zipcode": ""}
"street": "", "city": "", "zipcode": "", "state": ""}
}
@@ -258,7 +260,7 @@ def test_invoice_shredder(event, order):
inv = generate_invoice(order)
invoice_pdf_task.apply(args=(inv.pk,))
inv.refresh_from_db()
assert inv.invoice_to == "Acme Company\n\n221B Baker Street\n12345 London"
assert inv.invoice_to == "Acme Company\n221B Baker Street\n12345 London"
assert inv.file
fname = inv.file.path
assert os.path.exists(fname)