Rename billing to rating

Change-Id: Iade42794716419e008349a77901736a532c533d9
This commit is contained in:
Guillaume Espanel
2015-04-08 15:25:14 +00:00
parent 9ab382643a
commit b299a805a9
10 changed files with 46 additions and 46 deletions

View File

@@ -19,7 +19,7 @@ import cloudkittyclient.v1.core
fixtures = { fixtures = {
'/v1/billing/modules': { '/v1/rating/modules': {
'GET': ( 'GET': (
{}, {},
{'modules': [ {'modules': [
@@ -34,7 +34,7 @@ fixtures = {
]}, ]},
), ),
}, },
'/v1/billing/modules/hashmap': { '/v1/rating/modules/hashmap': {
'GET': ( 'GET': (
{}, {},
{ {
@@ -50,7 +50,7 @@ fixtures = {
} }
), ),
}, },
'/v1/billing/modules/noop': { '/v1/rating/modules/noop': {
'GET': ( 'GET': (
{}, {},
{ {
@@ -91,7 +91,7 @@ class CloudkittyModuleManagerTest(utils.BaseTestCase):
def test_list_all(self): def test_list_all(self):
resources = list(self.mgr.list()) resources = list(self.mgr.list())
expect = [ expect = [
'GET', '/v1/billing/modules' 'GET', '/v1/rating/modules'
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
self.assertEqual(len(resources), 2) self.assertEqual(len(resources), 2)
@@ -101,7 +101,7 @@ class CloudkittyModuleManagerTest(utils.BaseTestCase):
def test_get_module_status(self): def test_get_module_status(self):
resource = self.mgr.get(module_id='hashmap') resource = self.mgr.get(module_id='hashmap')
expect = [ expect = [
'GET', '/v1/billing/modules/hashmap' 'GET', '/v1/rating/modules/hashmap'
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
self.assertEqual(resource.module_id, 'hashmap') self.assertEqual(resource.module_id, 'hashmap')
@@ -119,10 +119,10 @@ class CloudkittyModuleTest(utils.BaseTestCase):
def test_enable(self): def test_enable(self):
self.ck_module = self.mgr.get(module_id='noop') self.ck_module = self.mgr.get(module_id='noop')
self.ck_module.enable() self.ck_module.enable()
# PUT /v1/billing/modules/noop # PUT /v1/rating/modules/noop
# body : {'enabled': True} # body : {'enabled': True}
expect = [ expect = [
'PUT', '/v1/billing/modules/noop', {'module_id': 'noop', 'PUT', '/v1/rating/modules/noop', {'module_id': 'noop',
'enabled': True}, 'enabled': True},
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -130,10 +130,10 @@ class CloudkittyModuleTest(utils.BaseTestCase):
def test_disable(self): def test_disable(self):
self.ck_module = self.mgr.get(module_id='hashmap') self.ck_module = self.mgr.get(module_id='hashmap')
self.ck_module.disable() self.ck_module.disable()
# PUT /v1/billing/modules/hashmap # PUT /v1/rating/modules/hashmap
# body : {'enabled': False} # body : {'enabled': False}
expect = [ expect = [
'PUT', '/v1/billing/modules/hashmap', {'module_id': 'hashmap', 'PUT', '/v1/rating/modules/hashmap', {'module_id': 'hashmap',
'enabled': False}, 'enabled': False},
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)

View File

@@ -15,12 +15,12 @@
from cloudkittyclient.openstack.common.apiclient import client from cloudkittyclient.openstack.common.apiclient import client
from cloudkittyclient.openstack.common.apiclient import fake_client from cloudkittyclient.openstack.common.apiclient import fake_client
from cloudkittyclient.tests import utils from cloudkittyclient.tests import utils
from cloudkittyclient.v1.billing import hashmap from cloudkittyclient.v1.rating import hashmap
fixtures = { fixtures = {
# services # services
'/v1/billing/module_config/hashmap/services': { '/v1/rating/module_config/hashmap/services': {
'GET': ( 'GET': (
{}, {},
{'services': {'services':
@@ -42,7 +42,7 @@ fixtures = {
), ),
}, },
# a service # a service
('/v1/billing/module_config/hashmap/services/' ('/v1/rating/module_config/hashmap/services/'
'2451c2e0-2c6b-4e75-987f-93661eef0fd5'): { '2451c2e0-2c6b-4e75-987f-93661eef0fd5'): {
'GET': ( 'GET': (
{}, {},
@@ -57,7 +57,7 @@ fixtures = {
), ),
}, },
# a field # a field
('/v1/billing/module_config/hashmap/fields/' ('/v1/rating/module_config/hashmap/fields/'
'a53db546-bac0-472c-be4b-5bf9f6117581'): { 'a53db546-bac0-472c-be4b-5bf9f6117581'): {
'GET': ( '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'): { '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'): {
'GET': ( 'GET': (
{}, {},
@@ -96,7 +96,7 @@ fixtures = {
), ),
}, },
# a mapping # a mapping
('/v1/billing/module_config/hashmap/mappings/' ('/v1/rating/module_config/hashmap/mappings/'
'bff0d209-a8e4-46f8-8c1a-f231db375dcb'): { 'bff0d209-a8e4-46f8-8c1a-f231db375dcb'): {
'GET': ( 'GET': (
{}, {},
@@ -124,7 +124,7 @@ fixtures = {
), ),
}, },
# some mappings # some mappings
('/v1/billing/module_config/hashmap/mappings' ('/v1/rating/module_config/hashmap/mappings'
'?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'): { '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'): {
'GET': ( 'GET': (
{}, {},
@@ -165,7 +165,7 @@ fixtures = {
{}, {},
), ),
}, },
'/v1/billing/module_config/hashmap/groups': { '/v1/rating/module_config/hashmap/groups': {
'GET': ( 'GET': (
{}, {},
{'groups': {'groups':
@@ -186,7 +186,7 @@ fixtures = {
} }
), ),
}, },
('/v1/billing/module_config/hashmap/groups/' ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'): { 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'): {
'GET': ( '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'): { 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recursive=True'): {
'DELETE': ( 'DELETE': (
{}, {},
@@ -221,7 +221,7 @@ class ServiceManagerTest(utils.BaseTestCase):
def test_list_services(self): def test_list_services(self):
resources = list(self.mgr.list()) resources = list(self.mgr.list())
expect = [ expect = [
'GET', '/v1/billing/module_config/hashmap/services' 'GET', '/v1/rating/module_config/hashmap/services'
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
self.assertEqual(len(resources), 3) self.assertEqual(len(resources), 3)
@@ -238,7 +238,7 @@ class ServiceManagerTest(utils.BaseTestCase):
service_id='2451c2e0-2c6b-4e75-987f-93661eef0fd5' service_id='2451c2e0-2c6b-4e75-987f-93661eef0fd5'
) )
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/services/' 'GET', ('/v1/rating/module_config/hashmap/services/'
'2451c2e0-2c6b-4e75-987f-93661eef0fd5') '2451c2e0-2c6b-4e75-987f-93661eef0fd5')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -261,7 +261,7 @@ class ServiceTest(utils.BaseTestCase):
def test_get_fields(self): def test_get_fields(self):
fields = self.resource.fields[:] fields = self.resource.fields[:]
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/fields' 'GET', ('/v1/rating/module_config/hashmap/fields'
'?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'), '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'),
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -270,7 +270,7 @@ class ServiceTest(utils.BaseTestCase):
def test_get_mappings(self): def test_get_mappings(self):
mappings = self.resource.mappings[:] mappings = self.resource.mappings[:]
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/mappings' 'GET', ('/v1/rating/module_config/hashmap/mappings'
'?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'), '?service_id=2451c2e0-2c6b-4e75-987f-93661eef0fd5'),
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -290,7 +290,7 @@ class FieldManagerTest(utils.BaseTestCase):
field_id='a53db546-bac0-472c-be4b-5bf9f6117581' field_id='a53db546-bac0-472c-be4b-5bf9f6117581'
) )
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/fields/' 'GET', ('/v1/rating/module_config/hashmap/fields/'
'a53db546-bac0-472c-be4b-5bf9f6117581') 'a53db546-bac0-472c-be4b-5bf9f6117581')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -316,7 +316,7 @@ class MappingManagerTest(utils.BaseTestCase):
mapping_id='bff0d209-a8e4-46f8-8c1a-f231db375dcb' mapping_id='bff0d209-a8e4-46f8-8c1a-f231db375dcb'
) )
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/mappings/' 'GET', ('/v1/rating/module_config/hashmap/mappings/'
'bff0d209-a8e4-46f8-8c1a-f231db375dcb') 'bff0d209-a8e4-46f8-8c1a-f231db375dcb')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -340,7 +340,7 @@ class MappingManagerTest(utils.BaseTestCase):
resource.cost = 0.2 resource.cost = 0.2
self.mgr.update(**resource.dirty_fields) self.mgr.update(**resource.dirty_fields)
expect = [ expect = [
'PUT', ('/v1/billing/module_config/hashmap/mappings/' 'PUT', ('/v1/rating/module_config/hashmap/mappings/'
'bff0d209-a8e4-46f8-8c1a-f231db375dcb'), 'bff0d209-a8e4-46f8-8c1a-f231db375dcb'),
{u'mapping_id': u'bff0d209-a8e4-46f8-8c1a-f231db375dcb', {u'mapping_id': u'bff0d209-a8e4-46f8-8c1a-f231db375dcb',
u'cost': 0.2, u'type': u'flat', u'cost': 0.2, u'type': u'flat',
@@ -364,7 +364,7 @@ class GroupManagerTest(utils.BaseTestCase):
group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'
) )
expect = [ expect = [
'GET', ('/v1/billing/module_config/hashmap/groups/' 'GET', ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -375,7 +375,7 @@ class GroupManagerTest(utils.BaseTestCase):
def test_delete_a_group(self): def test_delete_a_group(self):
self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5')
expect = [ expect = [
'DELETE', ('/v1/billing/module_config/hashmap/groups/' 'DELETE', ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -384,7 +384,7 @@ class GroupManagerTest(utils.BaseTestCase):
self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5', self.mgr.delete(group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5',
recursive=True) recursive=True)
expect = [ expect = [
'DELETE', ('/v1/billing/module_config/hashmap/groups/' 'DELETE', ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recursive=True') 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recursive=True')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -403,9 +403,9 @@ class GroupTest(utils.BaseTestCase):
group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' group_id='aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'
) )
self.group.delete() self.group.delete()
# DELETE /v1/billing/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5 # DELETE /v1/rating/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5
expect = [ expect = [
'DELETE', ('/v1/billing/module_config/hashmap/groups/' 'DELETE', ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5') 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5')
] ]
self.http_client.assert_called(*expect) self.http_client.assert_called(*expect)
@@ -416,9 +416,9 @@ class GroupTest(utils.BaseTestCase):
) )
self.group.delete(recursive=True) self.group.delete(recursive=True)
# DELETE # DELETE
# /v1/billing/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recusrive=True # /v1/rating/groups/aaa1c2e0-2c6b-4e75-987f-93661eef0fd5?recusrive=True
expect = [ expect = [
'DELETE', ('/v1/billing/module_config/hashmap/groups/' 'DELETE', ('/v1/rating/module_config/hashmap/groups/'
'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5' 'aaa1c2e0-2c6b-4e75-987f-93661eef0fd5'
'?recursive=True') '?recursive=True')
] ]

View File

@@ -25,6 +25,6 @@ class Collector(base.Resource):
class CollectorManager(base.Manager): class CollectorManager(base.Manager):
resource_class = Collector resource_class = Collector
base_url = "/v1/billing" base_url = "/v1/rating"
key = "collector" key = "collector"
collection_key = "collectors" collection_key = "collectors"

View File

@@ -33,7 +33,7 @@ class CloudkittyModule(base.Resource):
class CloudkittyModuleManager(base.CrudManager): class CloudkittyModuleManager(base.CrudManager):
resource_class = CloudkittyModule resource_class = CloudkittyModule
base_url = "/v1/billing" base_url = "/v1/rating"
key = 'module' key = 'module'
collection_key = "modules" collection_key = "modules"
@@ -48,6 +48,6 @@ class Collector(base.Resource):
class CollectorManager(base.Manager): class CollectorManager(base.Manager):
resource_class = Collector resource_class = Collector
base_url = "/v1/billing" base_url = "/v1/rating"
key = "collector" key = "collector"
collection_key = "collectors" collection_key = "collectors"

View File

@@ -36,7 +36,7 @@ class Service(base.Resource):
class ServiceManager(base.CrudManager): class ServiceManager(base.CrudManager):
resource_class = Service resource_class = Service
base_url = '/v1/billing/module_config/hashmap' base_url = '/v1/rating/module_config/hashmap'
key = 'service' key = 'service'
collection_key = 'services' collection_key = 'services'
@@ -56,7 +56,7 @@ class Field(base.Resource):
class FieldManager(base.CrudManager): class FieldManager(base.CrudManager):
resource_class = Field resource_class = Field
base_url = '/v1/billing/module_config/hashmap' base_url = '/v1/rating/module_config/hashmap'
key = 'field' key = 'field'
collection_key = 'fields' collection_key = 'fields'
@@ -84,7 +84,7 @@ class Mapping(base.Resource):
class MappingManager(base.CrudManager): class MappingManager(base.CrudManager):
resource_class = Mapping resource_class = Mapping
base_url = '/v1/billing/module_config/hashmap' base_url = '/v1/rating/module_config/hashmap'
key = 'mapping' key = 'mapping'
collection_key = 'mappings' collection_key = 'mappings'
@@ -101,7 +101,7 @@ class Group(base.Resource):
class GroupManager(base.CrudManager): class GroupManager(base.CrudManager):
resource_class = Group resource_class = Group
base_url = '/v1/billing/module_config/hashmap' base_url = '/v1/rating/module_config/hashmap'
key = 'group' key = 'group'
collection_key = 'groups' collection_key = 'groups'

View File

@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from cloudkittyclient.v1.billing import hashmap from cloudkittyclient.v1.rating import hashmap
class Client(object): class Client(object):

View File

@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from cloudkittyclient.v1.billing.hashmap import client from cloudkittyclient.v1.rating.hashmap import client
from cloudkittyclient.v1.billing.hashmap import shell from cloudkittyclient.v1.rating.hashmap import shell
class Extension(object): class Extension(object):

View File

@@ -28,7 +28,7 @@ console_scripts =
cloudkitty = cloudkittyclient.shell:main cloudkitty = cloudkittyclient.shell:main
cloudkitty.client.modules = cloudkitty.client.modules =
hashmap = cloudkittyclient.v1.billing.hashmap.extension:Extension hashmap = cloudkittyclient.v1.rating.hashmap.extension:Extension
[build_sphinx] [build_sphinx]
source-dir = doc/source source-dir = doc/source