From c24b6f61e38ce035f78a54fd9d8c5ac5d002fe45 Mon Sep 17 00:00:00 2001 From: ZhiQiang Fan Date: Thu, 23 Apr 2015 11:16:36 +0800 Subject: move capabilities ut code to unit dir The unit test code for capabilities command are left alone, it should be under unit directory Change-Id: I6c9d4e75b44aeba8bd5e79b3c9cf531b928499b8 --- .../tests/unit/v2/test_capabilities.py | 58 ++++++++++++++++++++++ ceilometerclient/tests/v2/test_capabilities.py | 58 ---------------------- 2 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 ceilometerclient/tests/unit/v2/test_capabilities.py delete mode 100644 ceilometerclient/tests/v2/test_capabilities.py diff --git a/ceilometerclient/tests/unit/v2/test_capabilities.py b/ceilometerclient/tests/unit/v2/test_capabilities.py new file mode 100644 index 0000000..32468cb --- /dev/null +++ b/ceilometerclient/tests/unit/v2/test_capabilities.py @@ -0,0 +1,58 @@ +# Copyright 2014 Huawei Technologies Co., Ltd. +# +# 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. + +import testtools + +from ceilometerclient.openstack.common.apiclient import client +from ceilometerclient.openstack.common.apiclient import fake_client +from ceilometerclient.v2 import capabilities + + +CAPABILITIES = { + "alarm_storage": { + "storage:production_ready": True + }, + "api": { + "alarms:query:complex": True, + "alarms:query:simple": True + }, + "event_storage": { + "storage:production_ready": True + }, + "storage": { + "storage:production_ready": True + }, +} + +FIXTURES = { + '/v2/capabilities': { + 'GET': ( + {}, + CAPABILITIES + ), + }, +} + + +class CapabilitiesManagerTest(testtools.TestCase): + def setUp(self): + super(CapabilitiesManagerTest, self).setUp() + self.http_client = fake_client.FakeHTTPClient(fixtures=FIXTURES) + self.api = client.BaseClient(self.http_client) + self.mgr = capabilities.CapabilitiesManager(self.api) + + def test_capabilities_get(self): + capabilities = self.mgr.get() + self.http_client.assert_called('GET', '/v2/capabilities') + self.assertEqual(True, capabilities.api['alarms:query:complex']) diff --git a/ceilometerclient/tests/v2/test_capabilities.py b/ceilometerclient/tests/v2/test_capabilities.py deleted file mode 100644 index 32468cb..0000000 --- a/ceilometerclient/tests/v2/test_capabilities.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2014 Huawei Technologies Co., Ltd. -# -# 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. - -import testtools - -from ceilometerclient.openstack.common.apiclient import client -from ceilometerclient.openstack.common.apiclient import fake_client -from ceilometerclient.v2 import capabilities - - -CAPABILITIES = { - "alarm_storage": { - "storage:production_ready": True - }, - "api": { - "alarms:query:complex": True, - "alarms:query:simple": True - }, - "event_storage": { - "storage:production_ready": True - }, - "storage": { - "storage:production_ready": True - }, -} - -FIXTURES = { - '/v2/capabilities': { - 'GET': ( - {}, - CAPABILITIES - ), - }, -} - - -class CapabilitiesManagerTest(testtools.TestCase): - def setUp(self): - super(CapabilitiesManagerTest, self).setUp() - self.http_client = fake_client.FakeHTTPClient(fixtures=FIXTURES) - self.api = client.BaseClient(self.http_client) - self.mgr = capabilities.CapabilitiesManager(self.api) - - def test_capabilities_get(self): - capabilities = self.mgr.get() - self.http_client.assert_called('GET', '/v2/capabilities') - self.assertEqual(True, capabilities.api['alarms:query:complex']) -- cgit v1.2.1