Add ability to specify headers in PUT/PATCH request in functional tests

To work with blob need pass headers "Content-Type: application/octet-stream".
Method "self._check_artifact_put" for the send request PUT does
not support headers. It does not allow testing work with a blob.
So added ability to specify headers in PUT/PATCH request.

Change-Id: I3c832ef732d707eb93615a5ffb6f3f8debfbcd99
Closes-bug: #1490306
This commit is contained in:
Darja Shakhray
2015-10-13 10:01:02 +00:00
parent 27ca72587e
commit c0d92eb079
@@ -250,11 +250,15 @@ paste.filter_factory = glance.tests.utils:FakeAuthMiddleware.factory
self.assertEqual(status, response.status_code)
return response.text
def _check_artifact_patch(self, url, data, status=200):
return self._check_artifact_method("patch", url, data, status)
def _check_artifact_patch(self, url, data, status=200,
headers={'Content-Type': 'application/json'}):
return self._check_artifact_method("patch", url, data, status=status,
headers=headers)
def _check_artifact_put(self, url, data, status=200):
return self._check_artifact_method("put", url, data, status=status)
def _check_artifact_put(self, url, data, status=200,
headers={'Content-Type': 'application/json'}):
return self._check_artifact_method("put", url, data, status=status,
headers=headers)
def test_list_any_artifacts(self):
"""Returns information about all draft artifacts with given endpoint"""