API: Do not crash if invalid data type is given for name_parts

This commit is contained in:
Raphael Michel
2023-01-02 10:17:00 +01:00
parent d3698b3e2f
commit ddbe38ca53
3 changed files with 27 additions and 0 deletions

View File

@@ -179,3 +179,15 @@ def test_customer_delete(token_client, organizer, customer):
'/api/v1/organizers/{}/customers/{}/'.format(organizer.slug, customer.identifier),
)
assert resp.status_code == 405
@pytest.mark.django_db
def test_customer_patch_invalid_name(token_client, organizer, customer):
resp = token_client.patch(
'/api/v1/organizers/{}/customers/{}/'.format(organizer.slug, customer.identifier),
format='json',
data={
'name_parts': 'should be a dictionary',
}
)
assert resp.status_code == 400