Allow POST of files for unit testing

This commit is contained in:
Oliver 2022-02-08 23:38:18 +11:00
parent 1f473e42d0
commit 5376c5b022

View File

@ -106,12 +106,12 @@ class InvenTreeAPITestCase(APITestCase):
return response
def post(self, url, data, expected_code=None):
def post(self, url, data, expected_code=None, format='json'):
"""
Issue a POST request
"""
response = self.client.post(url, data=data, format='json')
response = self.client.post(url, data=data, format=format)
if expected_code is not None:
self.assertEqual(response.status_code, expected_code)
@ -130,12 +130,12 @@ class InvenTreeAPITestCase(APITestCase):
return response
def patch(self, url, data, files=None, expected_code=None):
def patch(self, url, data, expected_code=None, format='json'):
"""
Issue a PATCH request
"""
response = self.client.patch(url, data=data, files=files, format='json')
response = self.client.patch(url, data=data, format=format)
if expected_code is not None:
self.assertEqual(response.status_code, expected_code)