From b299a805a988f1e24a0d17879d55c476cae2d0e4 Mon Sep 17 00:00:00 2001 From: Guillaume Espanel Date: Wed, 8 Apr 2015 15:25:14 +0000 Subject: [PATCH] Rename billing to rating Change-Id: Iade42794716419e008349a77901736a532c533d9 --- cloudkittyclient/tests/v1/test_core.py | 22 ++++----- cloudkittyclient/tests/v1/test_hashmap.py | 48 +++++++++---------- cloudkittyclient/v1/collector/__init__.py | 2 +- cloudkittyclient/v1/core.py | 4 +- .../v1/{billing => rating}/__init__.py | 0 .../{billing => rating}/hashmap/__init__.py | 8 ++-- .../v1/{billing => rating}/hashmap/client.py | 2 +- .../{billing => rating}/hashmap/extension.py | 4 +- .../v1/{billing => rating}/hashmap/shell.py | 0 setup.cfg | 2 +- 10 files changed, 46 insertions(+), 46 deletions(-) rename cloudkittyclient/v1/{billing => rating}/__init__.py (100%) rename cloudkittyclient/v1/{billing => rating}/hashmap/__init__.py (93%) rename cloudkittyclient/v1/{billing => rating}/hashmap/client.py (95%) rename cloudkittyclient/v1/{billing => rating}/hashmap/extension.py (88%) rename cloudkittyclient/v1/{billing => rating}/hashmap/shell.py (100%) diff --git a/cloudkittyclient/tests/v1/test_core.py b/cloudkittyclient/tests/v1/test_core.py index a76ac88..b0e27ed 100644 --- a/cloudkittyclient/tests/v1/test_core.py +++ b/cloudkittyclient/tests/v1/test_core.py @@ -19,7 +19,7 @@ import cloudkittyclient.v1.core fixtures = { - '/v1/billing/modules': { + '/v1/rating/modules': { 'GET': ( {}, {'modules': [ @@ -34,7 +34,7 @@ fixtures = { ]}, ), }, - '/v1/billing/modules/hashmap': { + '/v1/rating/modules/hashmap': { 'GET': ( {}, { @@ -50,7 +50,7 @@ fixtures = { } ), }, - '/v1/billing/modules/noop': { + '/v1/rating/modules/noop': { 'GET': ( {}, { @@ -91,7 +91,7 @@ class CloudkittyModuleManagerTest(utils.BaseTestCase): def test_list_all(self): resources = list(self.mgr.list()) expect = [ - 'GET', '/v1/billing/modules' + 'GET', '/v1/rating/modules' ] self.http_client.assert_called(*expect) self.assertEqual(len(resources), 2) @@ -101,7 +101,7 @@ class CloudkittyModuleManagerTest(utils.BaseTestCase): def test_get_module_status(self): resource = self.mgr.get(module_id='hashmap') expect = [ - 'GET', '/v1/billing/modules/hashmap' + 'GET', '/v1/rating/modules/hashmap' ] self.http_client.assert_called(*expect) self.assertEqual(resource.module_id, 'hashmap') @@ -119,21 +119,21 @@ class CloudkittyModuleTest(utils.BaseTestCase): def test_enable(self): self.ck_module = self.mgr.get(module_id='noop') self.ck_module.enable() - # PUT /v1/billing/modules/noop + # PUT /v1/rating/modules/noop # body : {'enabled': True} expect = [ - 'PUT', '/v1/billing/modules/noop', {'module_id': 'noop', - 'enabled': True}, + 'PUT', '/v1/rating/modules/noop', {'module_id': 'noop', + 'enabled': True}, ] self.http_client.assert_called(*expect) def test_disable(self): self.ck_module = self.mgr.get(module_id='hashmap') self.ck_module.disable() - # PUT /v1/billing/modules/hashmap + # PUT /v1/rating/modules/hashmap # body : {'enabled': False} expect = [ - 'PUT', '/v1/billing/modules/hashmap', {'module_id': 'hashmap', - 'enabled': False}, + 'PUT', '/v1/rating/modules/hashmap', {'module_id': 'hashmap', + 'enabled': False}, ] self.http_client.assert_called(*expect) diff --git a/cloudkittyclient/tests/v1/test_hashmap.py b/cloudkittyclient/tests/v1/test_hashmap.py index fd146bf..d4c2072 100644 --- a/cloudkittyclient/tests/v1/test_hashmap.py +++ b/cloudkittyclient/tests/v1/test_hashmap.py @@ -15,12 +15,12 @@ from cloudkittyclient.openstack.common.apiclient import client from cloudkittyclient.openstack.common.apiclient import fake_client from cloudkittyclient.tests import utils -from cloudkittyclient.v1.billing import hashmap +from cloudkittyclient.v1.rating import hashmap fixtures = { # services - '/v1/billing/module_config/hashmap/services': { + '/v1/rating/module_config/hashmap/services': { 'GET': ( {}, {'services': @@ -42,7 +42,7 @@ fixtures = { ), }, # a service - ('/v1/billing/module_config/hashmap/services/' + ('/v1/rating/module_config/hashmap/services/' '2451c2e0-2c6b-4e75-987f-93661eef0fd5'): { 'GET': ( {}, @@ -57,7 +57,7 @@ fixtures = { ), }, # a field - ('/v1/billing/module_config/hashmap/fields/' + ('/v1/rating/module_config/hashmap/fields/' 'a53db546-bac0-472c-be4b-5bf9f6117581'): { 'GET': ( {}, @@ -72,7 +72,7 @@ fixtures = { {}, ), }, - ('/v1/billing/module_config/hashmap/fields' + ('/v1/rating/module_config/hashmap/fields' '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'): { 'GET': ( {}, @@ -96,7 +96,7 @@ fixtures = { ), }, # a mapping - ('/v1/billing/module_config/hashmap/mappings/' + ('/v1/rating/module_config/hashmap/mappings/' 'bff0d209-a8e4-46f8-8c1a-f231db375dcb'): { 'GET': ( {}, @@ -124,7 +124,7 @@ fixtures = { ), }, # some mappings - ('/v1/billing/module_config/hashmap/mappings' + ('/v1/rating/module_config/hashmap/mappings' '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'): { 'GET': ( {}, @@ -165,7 +165,7 @@ fixtures = { {}, ), }, - '/v1/billing/module_config/hashmap/groups': { + '/v1/rating/module_config/hashmap/groups': { 'GET': ( {}, {'groups': @@ -186,7 +186,7 @@ fixtures = { } ), }, - ('/v1/billing/module_config/hashmap/groups/' + ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'): { 'GET': ( {}, @@ -200,7 +200,7 @@ fixtures = { {}, ), }, - ('/v1/billing/module_config/hashmap/groups/' + ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recursive=True'): { 'DELETE': ( {}, @@ -221,7 +221,7 @@ class ServiceManagerTest(utils.BaseTestCase): def test_list_services(self): resources = list(self.mgr.list()) expect = [ - 'GET', '/v1/billing/module_config/hashmap/services' + 'GET', '/v1/rating/module_config/hashmap/services' ] self.http_client.assert_called(*expect) self.assertEqual(len(resources), 3) @@ -238,7 +238,7 @@ class ServiceManagerTest(utils.BaseTestCase): service_id='2451c2e0-2c6b-4e75-987f-93661eef0fd5' ) expect = [ - 'GET', ('/v1/billing/module_config/hashmap/services/' + 'GET', ('/v1/rating/module_config/hashmap/services/' '2451c2e0-2c6b-4e75-987f-93661eef0fd5') ] self.http_client.assert_called(*expect) @@ -261,7 +261,7 @@ class ServiceTest(utils.BaseTestCase): def test_get_fields(self): fields = self.resource.fields[:] expect = [ - 'GET', ('/v1/billing/module_config/hashmap/fields' + 'GET', ('/v1/rating/module_config/hashmap/fields' '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'), ] self.http_client.assert_called(*expect) @@ -270,7 +270,7 @@ class ServiceTest(utils.BaseTestCase): def test_get_mappings(self): mappings = self.resource.mappings[:] expect = [ - 'GET', ('/v1/billing/module_config/hashmap/mappings' + 'GET', ('/v1/rating/module_config/hashmap/mappings' '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'), ] self.http_client.assert_called(*expect) @@ -290,7 +290,7 @@ class FieldManagerTest(utils.BaseTestCase): field_id='a53db546-bac0-472c-be4b-5bf9f6117581' ) expect = [ - 'GET', ('/v1/billing/module_config/hashmap/fields/' + 'GET', ('/v1/rating/module_config/hashmap/fields/' 'a53db546-bac0-472c-be4b-5bf9f6117581') ] self.http_client.assert_called(*expect) @@ -316,7 +316,7 @@ class MappingManagerTest(utils.BaseTestCase): mapping_id='bff0d209-a8e4-46f8-8c1a-f231db375dcb' ) expect = [ - 'GET', ('/v1/billing/module_config/hashmap/mappings/' + 'GET', ('/v1/rating/module_config/hashmap/mappings/' 'bff0d209-a8e4-46f8-8c1a-f231db375dcb') ] self.http_client.assert_called(*expect) @@ -340,7 +340,7 @@ class MappingManagerTest(utils.BaseTestCase): resource.cost = 0.2 self.mgr.update(**resource.dirty_fields) expect = [ - 'PUT', ('/v1/billing/module_config/hashmap/mappings/' + 'PUT', ('/v1/rating/module_config/hashmap/mappings/' 'bff0d209-a8e4-46f8-8c1a-f231db375dcb'), {u'mapping_id': u'bff0d209-a8e4-46f8-8c1a-f231db375dcb', u'cost': 0.2, u'type': u'flat', @@ -364,7 +364,7 @@ class GroupManagerTest(utils.BaseTestCase): group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' ) expect = [ - 'GET', ('/v1/billing/module_config/hashmap/groups/' + 'GET', ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') ] self.http_client.assert_called(*expect) @@ -375,7 +375,7 @@ class GroupManagerTest(utils.BaseTestCase): def test_delete_a_group(self): self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') expect = [ - 'DELETE', ('/v1/billing/module_config/hashmap/groups/' + 'DELETE', ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') ] self.http_client.assert_called(*expect) @@ -384,7 +384,7 @@ class GroupManagerTest(utils.BaseTestCase): self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5', recursive=True) expect = [ - 'DELETE', ('/v1/billing/module_config/hashmap/groups/' + 'DELETE', ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recursive=True') ] self.http_client.assert_called(*expect) @@ -403,9 +403,9 @@ class GroupTest(utils.BaseTestCase): group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' ) self.group.delete() - # DELETE /v1/billing/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5 + # DELETE /v1/rating/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5 expect = [ - 'DELETE', ('/v1/billing/module_config/hashmap/groups/' + 'DELETE', ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') ] self.http_client.assert_called(*expect) @@ -416,9 +416,9 @@ class GroupTest(utils.BaseTestCase): ) self.group.delete(recursive=True) # DELETE - # /v1/billing/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recusrive=True + # /v1/rating/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recusrive=True expect = [ - 'DELETE', ('/v1/billing/module_config/hashmap/groups/' + 'DELETE', ('/v1/rating/module_config/hashmap/groups/' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' '?recursive=True') ] diff --git a/cloudkittyclient/v1/collector/__init__.py b/cloudkittyclient/v1/collector/__init__.py index eca9704..1e0c889 100644 --- a/cloudkittyclient/v1/collector/__init__.py +++ b/cloudkittyclient/v1/collector/__init__.py @@ -25,6 +25,6 @@ class Collector(base.Resource): class CollectorManager(base.Manager): resource_class = Collector - base_url = "/v1/billing" + base_url = "/v1/rating" key = "collector" collection_key = "collectors" diff --git a/cloudkittyclient/v1/core.py b/cloudkittyclient/v1/core.py index 8aa196d..0501c6c 100644 --- a/cloudkittyclient/v1/core.py +++ b/cloudkittyclient/v1/core.py @@ -33,7 +33,7 @@ class CloudkittyModule(base.Resource): class CloudkittyModuleManager(base.CrudManager): resource_class = CloudkittyModule - base_url = "/v1/billing" + base_url = "/v1/rating" key = 'module' collection_key = "modules" @@ -48,6 +48,6 @@ class Collector(base.Resource): class CollectorManager(base.Manager): resource_class = Collector - base_url = "/v1/billing" + base_url = "/v1/rating" key = "collector" collection_key = "collectors" diff --git a/cloudkittyclient/v1/billing/__init__.py b/cloudkittyclient/v1/rating/__init__.py similarity index 100% rename from cloudkittyclient/v1/billing/__init__.py rename to cloudkittyclient/v1/rating/__init__.py diff --git a/cloudkittyclient/v1/billing/hashmap/__init__.py b/cloudkittyclient/v1/rating/hashmap/__init__.py similarity index 93% rename from cloudkittyclient/v1/billing/hashmap/__init__.py rename to cloudkittyclient/v1/rating/hashmap/__init__.py index 2aa0abc..af6ee8d 100644 --- a/cloudkittyclient/v1/billing/hashmap/__init__.py +++ b/cloudkittyclient/v1/rating/hashmap/__init__.py @@ -36,7 +36,7 @@ class Service(base.Resource): class ServiceManager(base.CrudManager): resource_class = Service - base_url = '/v1/billing/module_config/hashmap' + base_url = '/v1/rating/module_config/hashmap' key = 'service' collection_key = 'services' @@ -56,7 +56,7 @@ class Field(base.Resource): class FieldManager(base.CrudManager): resource_class = Field - base_url = '/v1/billing/module_config/hashmap' + base_url = '/v1/rating/module_config/hashmap' key = 'field' collection_key = 'fields' @@ -84,7 +84,7 @@ class Mapping(base.Resource): class MappingManager(base.CrudManager): resource_class = Mapping - base_url = '/v1/billing/module_config/hashmap' + base_url = '/v1/rating/module_config/hashmap' key = 'mapping' collection_key = 'mappings' @@ -101,7 +101,7 @@ class Group(base.Resource): class GroupManager(base.CrudManager): resource_class = Group - base_url = '/v1/billing/module_config/hashmap' + base_url = '/v1/rating/module_config/hashmap' key = 'group' collection_key = 'groups' diff --git a/cloudkittyclient/v1/billing/hashmap/client.py b/cloudkittyclient/v1/rating/hashmap/client.py similarity index 95% rename from cloudkittyclient/v1/billing/hashmap/client.py rename to cloudkittyclient/v1/rating/hashmap/client.py index 4660e9c..5192ddc 100644 --- a/cloudkittyclient/v1/billing/hashmap/client.py +++ b/cloudkittyclient/v1/rating/hashmap/client.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from cloudkittyclient.v1.billing import hashmap +from cloudkittyclient.v1.rating import hashmap class Client(object): diff --git a/cloudkittyclient/v1/billing/hashmap/extension.py b/cloudkittyclient/v1/rating/hashmap/extension.py similarity index 88% rename from cloudkittyclient/v1/billing/hashmap/extension.py rename to cloudkittyclient/v1/rating/hashmap/extension.py index d2e64e8..32bb0d0 100644 --- a/cloudkittyclient/v1/billing/hashmap/extension.py +++ b/cloudkittyclient/v1/rating/hashmap/extension.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from cloudkittyclient.v1.billing.hashmap import client -from cloudkittyclient.v1.billing.hashmap import shell +from cloudkittyclient.v1.rating.hashmap import client +from cloudkittyclient.v1.rating.hashmap import shell class Extension(object): diff --git a/cloudkittyclient/v1/billing/hashmap/shell.py b/cloudkittyclient/v1/rating/hashmap/shell.py similarity index 100% rename from cloudkittyclient/v1/billing/hashmap/shell.py rename to cloudkittyclient/v1/rating/hashmap/shell.py diff --git a/setup.cfg b/setup.cfg index 63b1e29..40cb6df 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ console_scripts = cloudkitty = cloudkittyclient.shell:main cloudkitty.client.modules = - hashmap = cloudkittyclient.v1.billing.hashmap.extension:Extension + hashmap = cloudkittyclient.v1.rating.hashmap.extension:Extension [build_sphinx] source-dir = doc/source