From c0d92eb07939a2eb110c935bbb4c159e6a380ff9 Mon Sep 17 00:00:00 2001 From: Darja Shakhray Date: Mon, 31 Aug 2015 11:03:07 +0300 Subject: [PATCH] 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 --- glance/tests/functional/artifacts/test_artifacts.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/glance/tests/functional/artifacts/test_artifacts.py b/glance/tests/functional/artifacts/test_artifacts.py index 7415224d48..1ab826c2e8 100644 --- a/glance/tests/functional/artifacts/test_artifacts.py +++ b/glance/tests/functional/artifacts/test_artifacts.py @@ -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"""