Merge "Add find_service_endpoint keystone function."
This commit is contained in:
commit
349afce81a
@ -22,6 +22,7 @@ keystone_client = _client.keystone_client
|
||||
get_keystone_client = _client.get_keystone_client
|
||||
find_service = _client.find_service
|
||||
find_endpoint = _client.find_endpoint
|
||||
find_service_endpoint = _client.find_service_endpoint
|
||||
list_endpoints = _client.list_endpoints
|
||||
list_services = _client.list_services
|
||||
KeystoneClientFixture = _client.KeystoneClientFixture
|
||||
|
@ -174,6 +174,14 @@ def find_resources(resources, **params):
|
||||
yield resource
|
||||
|
||||
|
||||
def find_service_endpoint(enabled=True, interface='public', client=None,
|
||||
**params):
|
||||
client = keystone_client(client)
|
||||
service = find_service(client=client, enabled=enabled, **params)
|
||||
return find_endpoint(client=client, service=service, interface=interface,
|
||||
enabled=enabled)
|
||||
|
||||
|
||||
class KeystoneResourceNotFound(tobiko.TobikoException):
|
||||
message = 'No such resource found with parameters {params!r}'
|
||||
|
||||
|
@ -152,21 +152,17 @@ class KeystoneClientAPITest(testtools.TestCase):
|
||||
endpoint = keystone.find_endpoint(url=url)
|
||||
self.assertEqual(url, endpoint.url)
|
||||
|
||||
def test_find_keystone_public_endpoint(self):
|
||||
def test_find_service_endpoint(self):
|
||||
service = keystone.find_service(name='keystone')
|
||||
endpoint = keystone.find_endpoint(service=service,
|
||||
interface='public',
|
||||
enabled=True)
|
||||
endpoint = keystone.find_service_endpoint(name='keystone')
|
||||
self.assertEqual(service.id, endpoint.service_id)
|
||||
self.assertEqual('public', endpoint.interface)
|
||||
self.assertTrue(endpoint.enabled)
|
||||
|
||||
@keystone.skip_if_missing_service(name='octavia')
|
||||
def test_find_octavia_public_endpoint(self):
|
||||
def test_find_octavia_service_endpoint(self):
|
||||
service = keystone.find_service(name='octavia')
|
||||
endpoint = keystone.find_endpoint(service=service,
|
||||
interface='public',
|
||||
enabled=True)
|
||||
endpoint = keystone.find_service_endpoint(name='octavia')
|
||||
self.assertEqual(service.id, endpoint.service_id)
|
||||
self.assertEqual('public', endpoint.interface)
|
||||
self.assertTrue(endpoint.enabled)
|
||||
|
Loading…
Reference in New Issue
Block a user