Ignore aodh_endpoint argument

When using keystone session, we seem to pass all **kwargs to
SessionClient for metering. We should drop the 'aodh_endpoint'
from kwargs.

Change-Id: Iaf28d4a525d49f62a0ae635dc1102cc1f0308c74
Closes-Bug: #1589425
This commit is contained in:
rabi
2016-06-06 14:18:15 +05:30
parent c00152ca3e
commit 0a1a8d2580
2 changed files with 20 additions and 1 deletions

View File

@@ -402,6 +402,8 @@ def _construct_http_client(**kwargs):
# Drop legacy options
for opt in LEGACY_OPTS:
kwargs.pop(opt, None)
# Drop aodh_endpoint from kwargs
kwargs.pop('aodh_endpoint', None)
return SessionClient(
session=kwargs.pop('session'),

View File

@@ -228,6 +228,24 @@ class ClientTestWithAodh(ClientTest):
ceiloclient = client.get_client(2, **env)
self.assertIsInstance(ceiloclient, v2client.Client)
@mock.patch('ceilometerclient.client.SessionClient')
def test_http_client_with_session_and_aodh(self, mock_sc):
session = mock.Mock()
kwargs = {"session": session,
"service_type": "metering",
"user_agent": "python-ceilometerclient"}
expected = {
"auth": None,
"interface": 'publicURL',
"region_name": None,
"timings": None,
"session": session,
"service_type": "metering",
"user_agent": "python-ceilometerclient"}
kwargs['aodh_endpoint'] = 'http://aodh.where'
client._construct_http_client(**kwargs)
mock_sc.assert_called_with(**expected)
class ClientAuthTest(utils.BaseTestCase):
@@ -351,7 +369,6 @@ class ClientAuthTest(utils.BaseTestCase):
session = mock.Mock()
session.request.return_value = mock.Mock(status_code=404,
text=b'')
env = {"session": session,
"service_type": "metering",
"user_agent": "python-ceilometerclient"}