diff --git a/openstack/metric/v1/_proxy.py b/openstack/metric/v1/_proxy.py new file mode 100644 index 00000000..49a5ff36 --- /dev/null +++ b/openstack/metric/v1/_proxy.py @@ -0,0 +1,22 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack.metric.v1 import capabilities + + +class Proxy(object): + + def __init__(self, session): + self.session = session + + def list_capabilities(self): + return capabilities.Capabilities.list(self.session) diff --git a/openstack/tests/metric/v1/test_proxy.py b/openstack/tests/metric/v1/test_proxy.py new file mode 100644 index 00000000..e44b9346 --- /dev/null +++ b/openstack/tests/metric/v1/test_proxy.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack.metric.v1 import _proxy +from openstack.tests import test_proxy_base + + +class TestMetricProxy(test_proxy_base.TestProxyBase): + def setUp(self): + super(TestMetricProxy, self).setUp() + self.proxy = _proxy.Proxy(self.session) + + def test_capabilities_list(self): + self.verify_list('openstack.metric.v1.capabilities.Capabilities.list', + self.proxy.list_capabilities) diff --git a/openstack/tests/test_user_preference.py b/openstack/tests/test_user_preference.py index 337f193f..7418b6bc 100644 --- a/openstack/tests/test_user_preference.py +++ b/openstack/tests/test_user_preference.py @@ -25,6 +25,7 @@ class TestUserPreference(base.TestCase): 'image', 'keystore', 'metering', + 'metric', 'network', 'object-store', 'orchestration', @@ -48,6 +49,9 @@ class TestUserPreference(base.TestCase): self.assertEqual(None, pref.get_preference('metering')) pref.set_version('metering', 'v6') self.assertEqual('v6', pref.get_preference('metering').version) + self.assertEqual(None, pref.get_preference('metric')) + pref.set_version('metric', 'v9') + self.assertEqual('v9', pref.get_preference('metric').version) self.assertEqual(None, pref.get_preference('network')) pref.set_version('network', 'v7') self.assertEqual('v7', pref.get_preference('network').version) diff --git a/openstack/user_preference.py b/openstack/user_preference.py index bb978006..32cea539 100644 --- a/openstack/user_preference.py +++ b/openstack/user_preference.py @@ -59,6 +59,7 @@ from openstack import exceptions from openstack.identity import identity_service from openstack.image import image_service from openstack.keystore import keystore_service +from openstack.metric import metric_service from openstack.network import network_service from openstack.object_store import object_store_service from openstack.orchestration import orchestration_service @@ -97,6 +98,9 @@ class UserPreference(object): serv = image_service.ImageService() serv.set_visibility(None) self._services[serv.service_type] = serv + serv = metric_service.MetricService() + serv.set_visibility(None) + self._services[serv.service_type] = serv serv = network_service.NetworkService() serv.set_visibility(None) self._services[serv.service_type] = serv