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:
Mehdi Abaakouk
2015-11-19 16:29:53 +01:00
parent 52d518537d
commit 25070cd88e
2 changed files with 11 additions and 1 deletions

View File

@@ -508,7 +508,6 @@ class SessionClient(adapter.LegacyJsonAdapter):
super(SessionClient, self).__init__(*args, **kwargs)
def request(self, url, method, **kwargs):
self.session.request(url, method)
kwargs.setdefault('headers', kwargs.get('headers', {}))
# NOTE(sileht): The standard call raises errors from
# keystoneauth, where we need to raise the gnocchiclient errors.

View File

@@ -379,6 +379,17 @@ class ClientAuthTest(utils.BaseTestCase):
session_instance_mock.get_endpoint.assert_called_with(
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):
env = FAKE_ENV.copy()
env.pop('auth_plugin', None)