Merge "add metric proxy and service"

This commit is contained in:
Jenkins
2015-02-21 01:38:19 +00:00
committed by Gerrit Code Review
4 changed files with 54 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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