Remove double API requests
When a keystone session object is used API call are done twice. This change fixes that. Change-Id: I79815520b996bce954fe531193f1a0229ef30060
This commit is contained in:
@@ -508,7 +508,6 @@ class SessionClient(adapter.LegacyJsonAdapter):
|
|||||||
super(SessionClient, self).__init__(*args, **kwargs)
|
super(SessionClient, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def request(self, url, method, **kwargs):
|
def request(self, url, method, **kwargs):
|
||||||
self.session.request(url, method)
|
|
||||||
kwargs.setdefault('headers', kwargs.get('headers', {}))
|
kwargs.setdefault('headers', kwargs.get('headers', {}))
|
||||||
# NOTE(sileht): The standard call raises errors from
|
# NOTE(sileht): The standard call raises errors from
|
||||||
# keystoneauth, where we need to raise the gnocchiclient errors.
|
# keystoneauth, where we need to raise the gnocchiclient errors.
|
||||||
|
|||||||
@@ -379,6 +379,17 @@ class ClientAuthTest(utils.BaseTestCase):
|
|||||||
session_instance_mock.get_endpoint.assert_called_with(
|
session_instance_mock.get_endpoint.assert_called_with(
|
||||||
region_name=None, interface='publicURL', service_type='alarming')
|
region_name=None, interface='publicURL', service_type='alarming')
|
||||||
|
|
||||||
|
def test_http_client_with_session(self):
|
||||||
|
session = mock.Mock()
|
||||||
|
session.request.return_value = mock.Mock(status_code=404,
|
||||||
|
text=b'')
|
||||||
|
|
||||||
|
env = {"session": session,
|
||||||
|
"service_type": "metering",
|
||||||
|
"user_agent": "python-ceilometerclient"}
|
||||||
|
c = client.SessionClient(**env)
|
||||||
|
self.assertRaises(exc.HTTPException, c.get, "/")
|
||||||
|
|
||||||
def test_get_aodh_endpoint_without_auth_url(self):
|
def test_get_aodh_endpoint_without_auth_url(self):
|
||||||
env = FAKE_ENV.copy()
|
env = FAKE_ENV.copy()
|
||||||
env.pop('auth_plugin', None)
|
env.pop('auth_plugin', None)
|
||||||
|
|||||||
Reference in New Issue
Block a user