]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
qa/tasks/mgr/dashboard: accept headers as an option param
authorKefu Chai <tchaikov@gmail.com>
Sun, 21 Aug 2022 23:57:47 +0000 (07:57 +0800)
committerKefu Chai <tchaikov@gmail.com>
Mon, 22 Aug 2022 06:01:16 +0000 (14:01 +0800)
commitafe8058b6cd583a9f5bc619d9e6462df0137215d
treec6c7bc83c95ef4243c735fbf3bd16f2cabf8f403
parent5fd0f9cd4838c75a8c05674ffa320f6dbee3b76a
qa/tasks/mgr/dashboard: accept headers as an option param

* add optional "headers" parameter to _request() and _get()
* correct the test of test_force_no_gzip, as the header in response
  should be "application/vnd.ceph.api.v1.0+json", not "application/json"

with this change, we are able to pass headers to _get() in dashboard api
tests.

without this change, we'd have following error when testing
`test_force_no_gzip` defined by `tasks.mgr.dashboard.test_requests.RequestsTest`:

raceback (most recent call last):
  File "/home/jenkins-build/build/workspace/ceph-api/src/pybind/mgr/dashboard/services/exception.py", line 47, in dashboard_exception_handler
    return handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/jenkins-build/build/workspace/ceph-api/src/pybind/mgr/dashboard/controllers/_base_controller.py", line 263, in inner
    ret = func(*args, **kwargs)
TypeError: Summary.__call__() got an unexpected keyword argument 'headers'

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
qa/tasks/mgr/dashboard/helper.py
qa/tasks/mgr/dashboard/test_requests.py