Handle exception with invalid HTTP content_type.

Signed-off-by: Yunfan Zhang <yz322@duke.edu>
This commit is contained in:
Yunfan Zhang
2018-07-03 11:52:52 -04:00
parent 6f63c7ba38
commit b4890ee331
2 changed files with 15 additions and 1 deletions

View File

@@ -107,3 +107,13 @@ def test_filterable_fields(options, instance, admin_user):
assert filterable_info['filterable'] is True
assert 'filterable' not in non_filterable_info
@pytest.mark.django_db
def test_handle_content_type(post, admin):
''' Tower should return 415 when wrong content type is in HTTP requests '''
post(reverse('api:project_list'),
{'name': 't', 'organization': None},
admin,
content_type='text/html',
expect=415)