Merge "Rename ENDPOINT to COMPUTE_ENDPOINT"

This commit is contained in:
Jenkins 2017-02-09 15:21:39 +00:00 committed by Gerrit Code Review
commit 6ff03db0a8
6 changed files with 37 additions and 36 deletions

View File

@ -22,7 +22,7 @@ PROJECT_ID = '1c36b64c840a42cd9e9b931a369337f0'
FLAVOR_ID = u'0c1d9008-f546-4608-9e8f-f8bdaec8dddd'
CHOCOLATE_FLAVOR_ID = u'0c1d9008-f546-4608-9e8f-f8bdaec8ddde'
STRAWBERRY_FLAVOR_ID = u'0c1d9008-f546-4608-9e8f-f8bdaec8dddf'
ENDPOINT = 'https://compute.example.com/v2.1/{project_id}'.format(
COMPUTE_ENDPOINT = 'https://compute.example.com/v2.1/{project_id}'.format(
project_id=PROJECT_ID)
@ -34,11 +34,11 @@ def make_fake_flavor(flavor_id, name, ram=100, disk=1600, vcpus=24):
u'id': flavor_id,
u'links': [{
u'href': u'{endpoint}/flavors/{id}'.format(
endpoint=ENDPOINT, id=flavor_id),
endpoint=COMPUTE_ENDPOINT, id=flavor_id),
u'rel': u'self'
}, {
u'href': u'{endpoint}/flavors/{id}'.format(
endpoint=ENDPOINT, id=flavor_id),
endpoint=COMPUTE_ENDPOINT, id=flavor_id),
u'rel': u'bookmark'
}],
u'name': name,

View File

@ -302,17 +302,17 @@ class TestMemoryCache(base.RequestsMockTestCase):
def test_list_flavors(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': []})
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
for flavor in fakes.FAKE_FLAVOR_LIST:
self.register_uri(
'GET', '{endpoint}/flavors/{id}/os-extra_specs'.format(
endpoint=fakes.ENDPOINT, id=flavor['id']),
endpoint=fakes.COMPUTE_ENDPOINT, id=flavor['id']),
json={'extra_specs': {}})
self.assertEqual([], self.cloud.list_flavors())

View File

@ -315,7 +315,7 @@ class TestCreateServer(base.RequestsMockTestCase):
self, mock_nova, mock_image, mock_get_server_by_id):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
self.cloud.create_server(
'server-name', 'image-id', 'vanilla',

View File

@ -22,7 +22,7 @@ class TestFlavors(base.RequestsMockTestCase):
self.register_uri(
'POST', '{endpoint}/flavors'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavor': fakes.FAKE_FLAVOR},
validate=dict(
json={'flavor': {
@ -45,11 +45,11 @@ class TestFlavors(base.RequestsMockTestCase):
def test_delete_flavor(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
self.register_uri(
'DELETE', '{endpoint}/flavors/{id}'.format(
endpoint=fakes.ENDPOINT, id=fakes.FLAVOR_ID))
endpoint=fakes.COMPUTE_ENDPOINT, id=fakes.FLAVOR_ID))
self.assertTrue(self.op_cloud.delete_flavor('vanilla'))
self.assert_calls()
@ -57,7 +57,7 @@ class TestFlavors(base.RequestsMockTestCase):
def test_delete_flavor_not_found(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
self.assertFalse(self.op_cloud.delete_flavor('invalid'))
@ -67,11 +67,11 @@ class TestFlavors(base.RequestsMockTestCase):
def test_delete_flavor_exception(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
self.register_uri(
'DELETE', '{endpoint}/flavors/{id}'.format(
endpoint=fakes.ENDPOINT, id=fakes.FLAVOR_ID),
endpoint=fakes.COMPUTE_ENDPOINT, id=fakes.FLAVOR_ID),
status_code=503)
self.assertRaises(shade.OpenStackCloudException,
self.op_cloud.delete_flavor, 'vanilla')
@ -79,12 +79,12 @@ class TestFlavors(base.RequestsMockTestCase):
def test_list_flavors(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
for flavor in fakes.FAKE_FLAVOR_LIST:
self.register_uri(
'GET', '{endpoint}/flavors/{id}/os-extra_specs'.format(
endpoint=fakes.ENDPOINT, id=flavor['id']),
endpoint=fakes.COMPUTE_ENDPOINT, id=flavor['id']),
json={'extra_specs': {}})
flavors = self.cloud.list_flavors()
@ -105,12 +105,12 @@ class TestFlavors(base.RequestsMockTestCase):
def test_get_flavor_by_ram(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
for flavor in fakes.FAKE_FLAVOR_LIST:
self.register_uri(
'GET', '{endpoint}/flavors/{id}/os-extra_specs'.format(
endpoint=fakes.ENDPOINT, id=flavor['id']),
endpoint=fakes.COMPUTE_ENDPOINT, id=flavor['id']),
json={'extra_specs': {}})
flavor = self.cloud.get_flavor_by_ram(ram=250)
@ -119,12 +119,12 @@ class TestFlavors(base.RequestsMockTestCase):
def test_get_flavor_by_ram_and_include(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': fakes.FAKE_FLAVOR_LIST})
for flavor in fakes.FAKE_FLAVOR_LIST:
self.register_uri(
'GET', '{endpoint}/flavors/{id}/os-extra_specs'.format(
endpoint=fakes.ENDPOINT, id=flavor['id']),
endpoint=fakes.COMPUTE_ENDPOINT, id=flavor['id']),
json={'extra_specs': {}})
flavor = self.cloud.get_flavor_by_ram(ram=150, include='strawberry')
self.assertEqual(fakes.STRAWBERRY_FLAVOR_ID, flavor['id'])
@ -132,7 +132,7 @@ class TestFlavors(base.RequestsMockTestCase):
def test_get_flavor_by_ram_not_found(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': []})
self.assertRaises(
shade.OpenStackCloudException,
@ -142,19 +142,19 @@ class TestFlavors(base.RequestsMockTestCase):
def test_get_flavor_string_and_int(self):
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': [fakes.make_fake_flavor('1', 'vanilla')]})
self.register_uri(
'GET', '{endpoint}/flavors/1/os-extra_specs'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'extra_specs': {}})
self.register_uri(
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'flavors': [fakes.make_fake_flavor('1', 'vanilla')]})
self.register_uri(
'GET', '{endpoint}/flavors/1/os-extra_specs'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'extra_specs': {}})
flavor1 = self.cloud.get_flavor('1')
@ -166,7 +166,7 @@ class TestFlavors(base.RequestsMockTestCase):
extra_specs = dict(key1='value1')
self.register_uri(
'POST', '{endpoint}/flavors/{id}/os-extra_specs'.format(
endpoint=fakes.ENDPOINT, id=1),
endpoint=fakes.COMPUTE_ENDPOINT, id=1),
json=dict(extra_specs=extra_specs))
self.op_cloud.set_flavor_specs(1, extra_specs)
@ -178,7 +178,7 @@ class TestFlavors(base.RequestsMockTestCase):
self.register_uri(
'DELETE',
'{endpoint}/flavors/{id}/os-extra_specs/{key}'.format(
endpoint=fakes.ENDPOINT, id=1, key=key))
endpoint=fakes.COMPUTE_ENDPOINT, id=1, key=key))
self.op_cloud.unset_flavor_specs(1, keys)
self.assert_calls()
@ -186,7 +186,7 @@ class TestFlavors(base.RequestsMockTestCase):
def test_add_flavor_access(self):
self.register_uri(
'POST', '{endpoint}/flavors/{id}/action'.format(
endpoint=fakes.ENDPOINT, id='flavor_id'),
endpoint=fakes.COMPUTE_ENDPOINT, id='flavor_id'),
json={
'flavor_access': [{
'flavor_id': 'flavor_id',
@ -204,7 +204,7 @@ class TestFlavors(base.RequestsMockTestCase):
def test_remove_flavor_access(self):
self.register_uri(
'POST', '{endpoint}/flavors/{id}/action'.format(
endpoint=fakes.ENDPOINT, id='flavor_id'),
endpoint=fakes.COMPUTE_ENDPOINT, id='flavor_id'),
json={'flavor_access': []},
validate=dict(
json={
@ -218,7 +218,7 @@ class TestFlavors(base.RequestsMockTestCase):
def test_list_flavor_access(self):
self.register_uri(
'GET', '{endpoint}/flavors/vanilla/os-flavor-access'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={
'flavor_access': [{
'flavor_id': 'vanilla',

View File

@ -451,7 +451,8 @@ class TestFloatingIP(base.RequestsMockTestCase):
self.register_uri(
'GET',
'{endpoint}/servers/detail'.format(endpoint=fakes.ENDPOINT),
'{endpoint}/servers/detail'.format(
endpoint=fakes.COMPUTE_ENDPOINT),
json={"servers": [{
"status": "ACTIVE",
"updated": "2017-02-06T20:59:49Z",

View File

@ -345,7 +345,7 @@ class TestMeta(base.RequestsMockTestCase):
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(
@ -396,7 +396,7 @@ class TestMeta(base.RequestsMockTestCase):
json={'subnets': SUBNETS_WITH_NAT})
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(
@ -445,7 +445,7 @@ class TestMeta(base.RequestsMockTestCase):
json={'subnets': SUBNETS_WITH_NAT})
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(
@ -513,7 +513,7 @@ class TestMeta(base.RequestsMockTestCase):
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(
@ -548,7 +548,7 @@ class TestMeta(base.RequestsMockTestCase):
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(
@ -605,7 +605,7 @@ class TestMeta(base.RequestsMockTestCase):
json={'subnets': OSIC_SUBNETS})
self.register_uri(
'GET', '{endpoint}/servers/test-id/os-security-groups'.format(
endpoint=fakes.ENDPOINT),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': []})
srv = self.cloud.get_openstack_vars(meta.obj_to_dict(fakes.FakeServer(