mirror of
https://github.com/ceph/ceph
synced 2025-01-10 13:10:46 +00:00
Merge pull request #47720 from tchaikov/wip-mgr-dashboard-test-with-headers
qa/tasks/mgr/dashboard: accept headers as a param Reviewed-by: Nizamudeen A <nia@redhat.com>
This commit is contained in:
commit
4bb9b6c424
@ -277,10 +277,11 @@ class DashboardTestCase(MgrTestCase):
|
||||
# pylint: disable=inconsistent-return-statements, too-many-arguments, too-many-branches
|
||||
@classmethod
|
||||
def _request(cls, url, method, data=None, params=None, version=DEFAULT_API_VERSION,
|
||||
set_cookies=False):
|
||||
set_cookies=False, headers=None):
|
||||
url = "{}{}".format(cls._base_uri, url)
|
||||
log.debug("Request %s to %s", method, url)
|
||||
headers = {}
|
||||
if headers is None:
|
||||
headers = {}
|
||||
cookies = {}
|
||||
if cls._token:
|
||||
if set_cookies:
|
||||
@ -336,8 +337,9 @@ class DashboardTestCase(MgrTestCase):
|
||||
raise ex
|
||||
|
||||
@classmethod
|
||||
def _get(cls, url, params=None, version=DEFAULT_API_VERSION, set_cookies=False):
|
||||
return cls._request(url, 'GET', params=params, version=version, set_cookies=set_cookies)
|
||||
def _get(cls, url, params=None, version=DEFAULT_API_VERSION, set_cookies=False, headers=None):
|
||||
return cls._request(url, 'GET', params=params, version=version,
|
||||
set_cookies=set_cookies, headers=headers)
|
||||
|
||||
@classmethod
|
||||
def _view_cache_get(cls, url, retries=5):
|
||||
|
@ -15,12 +15,10 @@ class RequestsTest(DashboardTestCase):
|
||||
})
|
||||
|
||||
def test_force_no_gzip(self):
|
||||
self._get('/api/summary', params=dict(
|
||||
headers={'Accept-Encoding': 'identity'}
|
||||
))
|
||||
self._get('/api/summary', headers={'Accept-Encoding': 'identity'})
|
||||
self.assertNotIn('Content-Encoding', self._resp.headers)
|
||||
self.assertHeaders({
|
||||
'Content-Type': 'application/json'
|
||||
'Content-Type': 'application/vnd.ceph.api.v{}+json'.format(DEFAULT_API_VERSION)
|
||||
})
|
||||
|
||||
def test_server(self):
|
||||
|
Loading…
Reference in New Issue
Block a user