Merge "Add tests to verify behavior on '' in self link"
This commit is contained in:
commit
25e45570ef
@ -468,6 +468,12 @@ class TestCase(base.TestCase):
|
||||
uri=compute_discovery_url,
|
||||
text=open(discovery_fixture, 'r').read())
|
||||
|
||||
def get_placement_discovery_mock_dict(self):
|
||||
discovery_fixture = os.path.join(
|
||||
self.fixtures_directory, "placement.json")
|
||||
return dict(method='GET', uri="https://placement.example.com/",
|
||||
text=open(discovery_fixture, 'r').read())
|
||||
|
||||
def get_designate_discovery_mock_dict(self):
|
||||
discovery_fixture = os.path.join(
|
||||
self.fixtures_directory, "dns.json")
|
||||
@ -500,6 +506,10 @@ class TestCase(base.TestCase):
|
||||
self.get_glance_discovery_mock_dict(
|
||||
image_version_json, image_discovery_url)])
|
||||
|
||||
def use_placement(self):
|
||||
self.__do_register_uris([
|
||||
self.get_placement_discovery_mock_dict()])
|
||||
|
||||
def use_designate(self):
|
||||
# NOTE(slaweq): This method is only meant to be used in "setUp"
|
||||
# where the ordering of the url being registered is tightly controlled
|
||||
|
@ -113,6 +113,20 @@
|
||||
"type": "object-store",
|
||||
"name": "swift"
|
||||
},
|
||||
{
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{
|
||||
"adminURL": "https://placement.example.com",
|
||||
"region": "RegionOne",
|
||||
"publicURL": "https://placement.example.com",
|
||||
"internalURL": "https://placement.example.com",
|
||||
"id": "652f0612744042bfbb8a8bb2c777a16e"
|
||||
}
|
||||
],
|
||||
"type": "placement",
|
||||
"name": "placement"
|
||||
},
|
||||
{
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
|
@ -136,6 +136,19 @@
|
||||
"name": "heat",
|
||||
"type": "orchestration"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
"id": "10c76ffd2b744a67950ed1365190d353",
|
||||
"interface": "public",
|
||||
"region": "RegionOne",
|
||||
"url": "https://placement.example.com"
|
||||
}
|
||||
],
|
||||
"endpoints_links": [],
|
||||
"name": "placement",
|
||||
"type": "placement"
|
||||
},
|
||||
{
|
||||
"endpoints": [
|
||||
{
|
||||
|
11
openstack/tests/unit/fixtures/placement.json
Normal file
11
openstack/tests/unit/fixtures/placement.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"id": "v1.0",
|
||||
"links": [{"href": "", "rel": "self"}],
|
||||
"max_version": "1.17",
|
||||
"min_version": "1.0",
|
||||
"status": "CURRENT"
|
||||
}
|
||||
]
|
||||
}
|
42
openstack/tests/unit/test_placement_rest.py
Normal file
42
openstack/tests/unit/test_placement_rest.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
|
||||
# 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.tests.unit import base
|
||||
|
||||
|
||||
class TestPlacementRest(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestPlacementRest, self).setUp()
|
||||
self.use_placement()
|
||||
|
||||
def test_discovery(self):
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
'placement', 'public', append=['allocation_candidates']),
|
||||
json={})
|
||||
])
|
||||
rs = self.cloud.placement.get('/allocation_candidates')
|
||||
self.assertEqual(200, rs.status_code)
|
||||
self.assertEqual(
|
||||
'https://placement.example.com/allocation_candidates',
|
||||
rs.url)
|
||||
self.assert_calls()
|
||||
|
||||
def test_microversion_discovery(self):
|
||||
self.assertEqual(
|
||||
(1, 17),
|
||||
self.cloud.placement.get_endpoint_data().max_microversion)
|
||||
self.assert_calls()
|
Loading…
x
Reference in New Issue
Block a user