Merge "Additional changes to support endpointtemplates operations.Disabling pylint msgs that dont fit."
This commit is contained in:
commit
6e19554822
|
@ -252,6 +252,9 @@ class BaseServiceAPI:
|
|||
def get_by_name(self, name):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_by_name_and_type(self, name, type):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_all(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ from keystone.backends.api import BaseRoleAPI
|
|||
|
||||
|
||||
class RoleAPI(BaseRoleAPI):
|
||||
# pylint: disable=W0221
|
||||
def create(self, values):
|
||||
role = models.Role()
|
||||
role.update(values)
|
||||
|
|
|
@ -23,6 +23,7 @@ class ServiceAPI(BaseServiceAPI):
|
|||
def __init__(self):
|
||||
pass
|
||||
|
||||
# pylint: disable=W0221
|
||||
def create(self, values):
|
||||
service_ref = models.Service()
|
||||
service_ref.update(values)
|
||||
|
@ -39,6 +40,14 @@ class ServiceAPI(BaseServiceAPI):
|
|||
session = get_session()
|
||||
return session.query(models.Service).filter_by(name=name).first()
|
||||
|
||||
def get_by_name_and_type(self, name, type, session=None):
|
||||
if not session:
|
||||
session = get_session()
|
||||
return session.query(models.Service).\
|
||||
filter_by(name=name).\
|
||||
filter_by(type=type).\
|
||||
first()
|
||||
|
||||
def get_all(self, session=None):
|
||||
if not session:
|
||||
session = get_session()
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
<!-- Complex Types -->
|
||||
<complexType name="Service">
|
||||
<attribute name="id" type="xsd:string" use="required"/>
|
||||
<attribute name="name" type="xsd:string" use="required"/>
|
||||
<attribute name="type" type="identity:ExtensibleServiceType" use="required"/>
|
||||
<attribute name="description" type="xsd:string" use="optional"/>
|
||||
<anyAttribute namespace="##other" processContents="lax"/>
|
||||
|
|
|
@ -809,18 +809,22 @@ class IdentityService(object):
|
|||
if not isinstance(endpoint_template, EndpointTemplate):
|
||||
raise fault.BadRequestFault("Expecting a EndpointTemplate")
|
||||
|
||||
if endpoint_template.service == None or \
|
||||
len(endpoint_template.service.strip()) == 0:
|
||||
if endpoint_template.name == None or \
|
||||
not endpoint_template.name.strip() \
|
||||
or endpoint_template.type == None or\
|
||||
not endpoint_template.type.strip():
|
||||
raise fault.BadRequestFault(
|
||||
"Expecting serviceId.")
|
||||
if endpoint_template.service != None and\
|
||||
len(endpoint_template.service.strip()) > 0 and\
|
||||
api.SERVICE.get(endpoint_template.service) == None:
|
||||
"Expecting name and type (Service).")
|
||||
|
||||
dservice = api.SERVICE.get_by_name_and_type(
|
||||
endpoint_template.name,
|
||||
endpoint_template.type)
|
||||
if dservice == None:
|
||||
raise fault.BadRequestFault(
|
||||
"A service with that id doesn't exist.")
|
||||
"A service with that name and type doesn't exist.")
|
||||
dendpoint_template = models.EndpointTemplates()
|
||||
dendpoint_template.region = endpoint_template.region
|
||||
dendpoint_template.service_id = endpoint_template.service
|
||||
dendpoint_template.service_id = dservice.id
|
||||
dendpoint_template.public_url = endpoint_template.public_url
|
||||
dendpoint_template.admin_url = endpoint_template.admin_url
|
||||
dendpoint_template.internal_url = endpoint_template.internal_url
|
||||
|
@ -845,13 +849,22 @@ class IdentityService(object):
|
|||
"The endpoint template could not be found")
|
||||
|
||||
#Check if the passed service exist.
|
||||
if endpoint_template.service != None and\
|
||||
len(endpoint_template.service.strip()) > 0 and\
|
||||
api.SERVICE.get(endpoint_template.service) == None:
|
||||
if endpoint_template.name == None or \
|
||||
not endpoint_template.name.strip() \
|
||||
or endpoint_template.type == None or\
|
||||
not endpoint_template.type.strip():
|
||||
raise fault.BadRequestFault(
|
||||
"A service with that id doesn't exist.")
|
||||
"Expecting name and type (Service).")
|
||||
|
||||
dservice = api.SERVICE.get_by_name_and_type(
|
||||
endpoint_template.name,
|
||||
endpoint_template.type)
|
||||
|
||||
if dservice == None:
|
||||
raise fault.BadRequestFault(
|
||||
"A service with that name and type doesn't exist.")
|
||||
dendpoint_template.region = endpoint_template.region
|
||||
dendpoint_template.service_id = endpoint_template.service
|
||||
dendpoint_template.service_id = dservice.id
|
||||
dendpoint_template.public_url = endpoint_template.public_url
|
||||
dendpoint_template.admin_url = endpoint_template.admin_url
|
||||
dendpoint_template.internal_url = endpoint_template.internal_url
|
||||
|
@ -865,7 +878,8 @@ class IdentityService(object):
|
|||
return EndpointTemplate(
|
||||
dendpoint_template.id,
|
||||
dendpoint_template.region,
|
||||
dendpoint_template.service_id,
|
||||
dservice.name,
|
||||
dservice.type,
|
||||
dendpoint_template.public_url,
|
||||
dendpoint_template.admin_url,
|
||||
dendpoint_template.internal_url,
|
||||
|
@ -896,10 +910,12 @@ class IdentityService(object):
|
|||
ts = []
|
||||
dendpoint_templates = api.ENDPOINT_TEMPLATE.get_page(marker, limit)
|
||||
for dendpoint_template in dendpoint_templates:
|
||||
dservice = api.SERVICE.get(dendpoint_template.service_id)
|
||||
ts.append(EndpointTemplate(
|
||||
dendpoint_template.id,
|
||||
dendpoint_template.region,
|
||||
dendpoint_template.service_id,
|
||||
dservice.name,
|
||||
dservice.type,
|
||||
dendpoint_template.public_url,
|
||||
dendpoint_template.admin_url,
|
||||
dendpoint_template.internal_url,
|
||||
|
@ -923,13 +939,15 @@ class IdentityService(object):
|
|||
self.__validate_service_or_keystone_admin_token(admin_token)
|
||||
|
||||
dendpoint_template = api.ENDPOINT_TEMPLATE.get(endpoint_template_id)
|
||||
dservice = api.SERVICE.get(dendpoint_template.service_id)
|
||||
if not dendpoint_template:
|
||||
raise fault.ItemNotFoundFault(
|
||||
"The endpoint template could not be found")
|
||||
return EndpointTemplate(
|
||||
dendpoint_template.id,
|
||||
dendpoint_template.region,
|
||||
dendpoint_template.service_id,
|
||||
dservice.name,
|
||||
dservice.type,
|
||||
dendpoint_template.public_url,
|
||||
dendpoint_template.admin_url,
|
||||
dendpoint_template.internal_url,
|
||||
|
@ -957,11 +975,13 @@ class IdentityService(object):
|
|||
for dtenant_endpoint in dtenant_endpoints:
|
||||
dendpoint_template = api.ENDPOINT_TEMPLATE.get(
|
||||
dtenant_endpoint.endpoint_template_id)
|
||||
dservice = api.SERVICE.get(dendpoint_template.service_id)
|
||||
ts.append(Endpoint(
|
||||
dtenant_endpoint.id,
|
||||
dtenant_endpoint.tenant_id,
|
||||
dendpoint_template.region,
|
||||
dendpoint_template.service_id,
|
||||
dservice.name,
|
||||
dservice.type,
|
||||
dendpoint_template.public_url,
|
||||
dendpoint_template.admin_url,
|
||||
dendpoint_template.internal_url,
|
||||
|
@ -998,11 +1018,13 @@ class IdentityService(object):
|
|||
dendpoint.tenant_id = tenant_id
|
||||
dendpoint.endpoint_template_id = endpoint_template.id
|
||||
dendpoint = api.ENDPOINT_TEMPLATE.endpoint_add(dendpoint)
|
||||
dservice = api.SERVICE.get(dendpoint_template.service_id)
|
||||
dendpoint = Endpoint(
|
||||
dendpoint.id,
|
||||
dendpoint.tenant_id,
|
||||
dendpoint_template.region,
|
||||
dendpoint_template.service_id,
|
||||
dservice.name,
|
||||
dservice.type,
|
||||
dendpoint_template.public_url,
|
||||
dendpoint_template.admin_url,
|
||||
dendpoint_template.internal_url,
|
||||
|
|
|
@ -35,7 +35,8 @@ class EndpointTemplate(object):
|
|||
raise fault.BadRequestFault("Expecting endpointTemplate")
|
||||
id = root.get("id")
|
||||
region = root.get("region")
|
||||
service = root.get("serviceId")
|
||||
name = root.get("name")
|
||||
type = root.get("type")
|
||||
public_url = root.get("publicURL")
|
||||
admin_url = root.get("adminURL")
|
||||
internal_url = root.get("internalURL")
|
||||
|
@ -56,7 +57,8 @@ class EndpointTemplate(object):
|
|||
if version.get('list'):
|
||||
version_list = version.get("list")
|
||||
|
||||
return EndpointTemplate(id, region, service, public_url, admin_url,
|
||||
return EndpointTemplate(id, region,
|
||||
name, type, public_url, admin_url,
|
||||
internal_url, enabled, is_global,
|
||||
version_id, version_list, version_info)
|
||||
except etree.LxmlError as e:
|
||||
|
@ -68,7 +70,8 @@ class EndpointTemplate(object):
|
|||
try:
|
||||
obj = json.loads(json_str)
|
||||
region = None
|
||||
service = None
|
||||
name = None
|
||||
type = None
|
||||
public_url = None
|
||||
admin_url = None
|
||||
internal_url = None
|
||||
|
@ -84,7 +87,7 @@ class EndpointTemplate(object):
|
|||
|
||||
# Check that fields are valid
|
||||
invalid = [key for key in endpoint_template if key not in
|
||||
['id', 'region', 'serviceId', 'publicURL',
|
||||
['id', 'region', 'name', 'type', 'publicURL',
|
||||
'adminURL', 'internalURL', 'enabled', 'global',
|
||||
'versionId', 'versionInfo', 'versionList']]
|
||||
if invalid != []:
|
||||
|
@ -98,8 +101,10 @@ class EndpointTemplate(object):
|
|||
|
||||
if 'region' in endpoint_template:
|
||||
region = endpoint_template["region"]
|
||||
if 'serviceId' in endpoint_template:
|
||||
service = endpoint_template["serviceId"]
|
||||
if 'name' in endpoint_template:
|
||||
name = endpoint_template["name"]
|
||||
if 'type' in endpoint_template:
|
||||
type = endpoint_template["type"]
|
||||
if 'publicURL' in endpoint_template:
|
||||
public_url = endpoint_template["publicURL"]
|
||||
if 'adminURL' in endpoint_template:
|
||||
|
@ -124,19 +129,20 @@ class EndpointTemplate(object):
|
|||
version_list = None
|
||||
|
||||
return EndpointTemplate(
|
||||
id, region, service, public_url, admin_url,
|
||||
id, region, name, type, public_url, admin_url,
|
||||
internal_url, enabled, is_global, version_id,
|
||||
version_list, version_info)
|
||||
except (ValueError, TypeError) as e:
|
||||
raise fault.BadRequestFault(\
|
||||
"Cannot parse endpointTemplate", str(e))
|
||||
|
||||
def __init__(self, id, region, service, public_url, admin_url,
|
||||
def __init__(self, id, region, name, type, public_url, admin_url,
|
||||
internal_url, enabled, is_global,
|
||||
version_id=None, version_list=None, version_info=None):
|
||||
self.id = id
|
||||
self.region = region
|
||||
self.service = service
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.public_url = public_url
|
||||
self.admin_url = admin_url
|
||||
self.internal_url = internal_url
|
||||
|
@ -154,8 +160,10 @@ class EndpointTemplate(object):
|
|||
dom.set("id", str(self.id))
|
||||
if self.region:
|
||||
dom.set("region", self.region)
|
||||
if self.service:
|
||||
dom.set("serviceId", str(self.service))
|
||||
if self.name:
|
||||
dom.set("name", str(self.name))
|
||||
if self.type:
|
||||
dom.set("type", str(self.type))
|
||||
if self.public_url:
|
||||
dom.set("publicURL", self.public_url)
|
||||
if self.admin_url:
|
||||
|
@ -187,8 +195,10 @@ class EndpointTemplate(object):
|
|||
endpoint_template["id"] = unicode(self.id)
|
||||
if self.region:
|
||||
endpoint_template["region"] = self.region
|
||||
if self.service:
|
||||
endpoint_template["serviceId"] = self.service
|
||||
if self.name:
|
||||
endpoint_template["name"] = self.name
|
||||
if self.type:
|
||||
endpoint_template["type"] = self.type
|
||||
if self.public_url:
|
||||
endpoint_template["publicURL"] = self.public_url
|
||||
if self.admin_url:
|
||||
|
@ -242,13 +252,15 @@ class EndpointTemplates(object):
|
|||
class Endpoint(object):
|
||||
"""Document me!"""
|
||||
|
||||
def __init__(self, id, tenant_id, region, service, public_url, admin_url,
|
||||
def __init__(self, id, tenant_id, region,
|
||||
name, type, public_url, admin_url,
|
||||
internal_url, version_id=None,
|
||||
version_list=None, version_info=None):
|
||||
self.id = id
|
||||
self.tenant_id = tenant_id
|
||||
self.region = region
|
||||
self.service = service
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.public_url = public_url
|
||||
self.admin_url = admin_url
|
||||
self.internal_url = internal_url
|
||||
|
@ -265,8 +277,10 @@ class Endpoint(object):
|
|||
dom.set("tenantId", self.tenant_id)
|
||||
if self.region:
|
||||
dom.set("region", self.region)
|
||||
if self.service:
|
||||
dom.set("serviceId", str(self.service))
|
||||
if self.name:
|
||||
dom.set("name", str(self.name))
|
||||
if self.type:
|
||||
dom.set("type", str(self.type))
|
||||
if self.public_url:
|
||||
dom.set("publicURL", self.public_url)
|
||||
if self.admin_url:
|
||||
|
@ -296,8 +310,10 @@ class Endpoint(object):
|
|||
endpoint["tenantId"] = self.tenant_id
|
||||
if self.region:
|
||||
endpoint["region"] = self.region
|
||||
if self.service:
|
||||
endpoint["serviceId"] = self.service
|
||||
if self.name:
|
||||
endpoint["name"] = self.name
|
||||
if self.type:
|
||||
endpoint["type"] = self.type
|
||||
if self.public_url:
|
||||
endpoint["publicURL"] = self.public_url
|
||||
if self.admin_url:
|
||||
|
|
|
@ -765,13 +765,14 @@ class FunctionalTestCase(ApiTestCase):
|
|||
def list_endpoint_templates(self, **kwargs):
|
||||
return self.get_endpoint_templates(**kwargs)
|
||||
|
||||
def create_endpoint_template(self, region=None, service_id=None,
|
||||
def create_endpoint_template(self, region=None, name=None, type=None,
|
||||
public_url=None, admin_url=None, internal_url=None, enabled=True,
|
||||
is_global=True, version_id=None,
|
||||
version_list=None, version_info=None, **kwargs):
|
||||
|
||||
region = optional_str(region)
|
||||
service_id = optional_str(service_id)
|
||||
name = optional_str(name)
|
||||
type = optional_str(type)
|
||||
public_url = optional_url(public_url)
|
||||
admin_url = optional_url(admin_url)
|
||||
internal_url = optional_url(internal_url)
|
||||
|
@ -782,7 +783,8 @@ class FunctionalTestCase(ApiTestCase):
|
|||
data = {
|
||||
"OS-KSCATALOG:endpointTemplate": {
|
||||
"region": region,
|
||||
"serviceId": service_id,
|
||||
"name": name,
|
||||
"type": type,
|
||||
"publicURL": public_url,
|
||||
"adminURL": admin_url,
|
||||
"internalURL": internal_url,
|
||||
|
@ -803,7 +805,7 @@ class FunctionalTestCase(ApiTestCase):
|
|||
return self.get_endpoint_template(endpoint_template_id, **kwargs)
|
||||
|
||||
def update_endpoint_template(self, endpoint_template_id=None, region=None,
|
||||
service_id=None, public_url=None, admin_url=None,
|
||||
name=None, type=None, public_url=None, admin_url=None,
|
||||
internal_url=None, enabled=None, is_global=None,
|
||||
version_id=None, version_list=None, version_info=None, **kwargs):
|
||||
|
||||
|
@ -812,8 +814,11 @@ class FunctionalTestCase(ApiTestCase):
|
|||
if region is not None:
|
||||
data['OS-KSCATALOG:endpointTemplate']['region'] = region
|
||||
|
||||
if service_id is not None:
|
||||
data['OS-KSCATALOG:endpointTemplate']['serviceId'] = service_id
|
||||
if name is not None:
|
||||
data['OS-KSCATALOG:endpointTemplate']['name'] = name
|
||||
|
||||
if type is not None:
|
||||
data['OS-KSCATALOG:endpointTemplate']['type'] = type
|
||||
|
||||
if public_url is not None:
|
||||
data['OS-KSCATALOG:endpointTemplate']['publicURL'] = public_url
|
||||
|
|
|
@ -35,7 +35,8 @@ class AuthenticationTest(common.FunctionalTestCase):
|
|||
for x in range(0, 5):
|
||||
self.services[x] = self.create_service().json['OS-KSADM:service']
|
||||
self.endpoint_templates[x] = self.create_endpoint_template(
|
||||
service_id=self.services[x]['id']).\
|
||||
name=self.services[x]['name'], \
|
||||
type=self.services[x]['type']).\
|
||||
json['OS-KSCATALOG:endpointTemplate']
|
||||
self.create_endpoint_for_tenant(self.tenant['id'],
|
||||
self.endpoint_templates[x]['id'])
|
||||
|
|
|
@ -25,18 +25,22 @@ class EndpointTemplatesTest(common.FunctionalTestCase):
|
|||
self.service = self.create_service().json['OS-KSADM:service']
|
||||
|
||||
self.endpoint_template = self.create_endpoint_template(
|
||||
service_id=self.service['id']).\
|
||||
name=self.service['name'], \
|
||||
type=self.service['type']).\
|
||||
json['OS-KSCATALOG:endpointTemplate']
|
||||
|
||||
|
||||
class CreateEndpointTemplatesTest(EndpointTemplatesTest):
|
||||
def test_create_endpoint_template(self):
|
||||
endpoint_template = self.create_endpoint_template(
|
||||
service_id=self.service['id'], assert_status=201).\
|
||||
name=self.service['name'],
|
||||
type=self.service['type'],
|
||||
assert_status=201).\
|
||||
json['OS-KSCATALOG:endpointTemplate']
|
||||
|
||||
self.assertIsNotNone(endpoint_template['id'], endpoint_template)
|
||||
self.assertIsNotNone(endpoint_template['serviceId'], endpoint_template)
|
||||
self.assertIsNotNone(endpoint_template['name'], endpoint_template)
|
||||
self.assertIsNotNone(endpoint_template['type'], endpoint_template)
|
||||
|
||||
def test_create_endpoint_template_xml(self):
|
||||
region = common.unique_str()
|
||||
|
@ -47,18 +51,20 @@ class CreateEndpointTemplatesTest(EndpointTemplatesTest):
|
|||
is_global = True
|
||||
|
||||
data = ('<?xml version="1.0" encoding="UTF-8"?> '
|
||||
'<endpointTemplate xmlns="%s" region="%s" serviceId="%s" '
|
||||
'publicURL="%s" adminURL="%s" '
|
||||
'<endpointTemplate xmlns="%s" region="%s" name="%s" '
|
||||
'type="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>'
|
||||
) % (self.xmlns_kscatalog, region, self.service['id'],
|
||||
public_url, admin_url, internal_url, enabled, is_global)
|
||||
) % (self.xmlns_kscatalog, region, self.service['name'],
|
||||
self.service['type'], public_url, admin_url, internal_url,
|
||||
enabled, is_global)
|
||||
r = self.post_endpoint_template(as_xml=data, assert_status=201)
|
||||
|
||||
self.assertEqual(r.xml.tag,
|
||||
'{%s}endpointTemplate' % self.xmlns_kscatalog)
|
||||
|
||||
self.assertIsNotNone(r.xml.get("id"))
|
||||
self.assertEqual(r.xml.get("serviceId"), self.service['id'])
|
||||
self.assertEqual(r.xml.get("name"), self.service['name'])
|
||||
self.assertEqual(r.xml.get("type"), self.service['type'])
|
||||
self.assertEqual(r.xml.get("region"), region)
|
||||
self.assertEqual(r.xml.get("publicURL"), public_url)
|
||||
self.assertEqual(r.xml.get("adminURL"), admin_url)
|
||||
|
@ -78,11 +84,14 @@ class CreateEndpointTemplatesTest(EndpointTemplatesTest):
|
|||
def test_create_endpoint_template_using_service_admin_token(self):
|
||||
self.admin_token = self.service_admin_token
|
||||
endpoint_template = self.create_endpoint_template(
|
||||
service_id=self.service['id'], assert_status=201).\
|
||||
name=self.service['name'],
|
||||
type=self.service['type'],
|
||||
assert_status=201).\
|
||||
json['OS-KSCATALOG:endpointTemplate']
|
||||
|
||||
self.assertIsNotNone(endpoint_template['id'])
|
||||
self.assertEqual(endpoint_template['serviceId'], self.service['id'])
|
||||
self.assertEqual(endpoint_template['name'], self.service['name'])
|
||||
self.assertEqual(endpoint_template['type'], self.service['type'])
|
||||
|
||||
|
||||
class GetEndpointTemplatesTest(EndpointTemplatesTest):
|
||||
|
@ -179,8 +188,8 @@ class GetEndpointTemplateTest(EndpointTemplatesTest):
|
|||
class UpdateEndpointTemplateTest(EndpointTemplatesTest):
|
||||
def test_update_endpoint(self):
|
||||
self.update_endpoint_template(self.endpoint_template['id'],
|
||||
name=self.service['name'], type=self.service['type'],
|
||||
assert_status=201)
|
||||
|
||||
# self.assertIsNotNone(r.json['endpointTemplate'].get('enabled'), r.json)
|
||||
|
||||
def test_update_endpoint_xml(self):
|
||||
|
@ -195,9 +204,11 @@ class UpdateEndpointTemplateTest(EndpointTemplatesTest):
|
|||
'<endpointTemplate '
|
||||
'xmlns="http://docs.openstack.org'
|
||||
'/identity/api/ext/OSKSCATALOG/v1.0" '
|
||||
'region="%s" serviceId="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>') % (region,
|
||||
self.service['id'], public_url, admin_url, internal_url,
|
||||
'region="%s" name="%s" type="%s"'
|
||||
' publicURL="%s" adminURL="%s"'
|
||||
' internalURL="%s" enabled="%s" global="%s"/>') % (region,
|
||||
self.service['name'], self.service['type'],
|
||||
public_url, admin_url, internal_url,
|
||||
enabled, is_global)
|
||||
r = self.put_endpoint_template(self.endpoint_template['id'],
|
||||
as_xml=data, assert_status=201, headers={
|
||||
|
@ -207,7 +218,8 @@ class UpdateEndpointTemplateTest(EndpointTemplatesTest):
|
|||
'{%s}endpointTemplate' % self.xmlns_kscatalog)
|
||||
|
||||
self.assertIsNotNone(r.xml.get("id"))
|
||||
self.assertEqual(r.xml.get("serviceId"), self.service['id'])
|
||||
self.assertEqual(r.xml.get("name"), self.service['name'])
|
||||
self.assertEqual(r.xml.get("type"), self.service['type'])
|
||||
self.assertEqual(r.xml.get("region"), region)
|
||||
self.assertEqual(r.xml.get("publicURL"), public_url)
|
||||
self.assertEqual(r.xml.get("adminURL"), admin_url)
|
||||
|
@ -300,7 +312,8 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
def test_endpoint_create_json(self):
|
||||
endpoint = self.create_endpoint_for_tenant(self.tenant['id'],
|
||||
self.endpoint_template['id'], assert_status=201).json['endpoint']
|
||||
self.assertEqual(str(endpoint["serviceId"]), str(self.service['id']))
|
||||
self.assertEqual(str(endpoint["name"]), str(self.service['name']))
|
||||
self.assertEqual(str(endpoint["type"]), str(self.service['type']))
|
||||
self.assertEqual(endpoint["region"], self.endpoint_template["region"])
|
||||
self.assertEqual(endpoint["publicURL"],
|
||||
self.endpoint_template["publicURL"])
|
||||
|
@ -327,7 +340,8 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
'{%s}endpoint' % self.xmlns)
|
||||
|
||||
self.assertIsNotNone(r.xml.get("id"))
|
||||
self.assertEqual(r.xml.get("serviceId"), self.service['id'])
|
||||
self.assertEqual(r.xml.get("name"), self.service['name'])
|
||||
self.assertEqual(r.xml.get("type"), self.service['type'])
|
||||
self.assertEqual(r.xml.get("region"), self.endpoint_template["region"])
|
||||
self.assertEqual(r.xml.get("publicURL"),
|
||||
self.endpoint_template["publicURL"])
|
||||
|
@ -342,9 +356,12 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
'<endpointTemplate '
|
||||
'xmlns="http://docs.openstack.org/identity'
|
||||
'/api/ext/OSKSCATALOG/v1.0" '
|
||||
'region="%s" serviceId="%s" publicURL="%s" adminURL="%s" '
|
||||
'region="%s" name="%s"'
|
||||
' type="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>') % (
|
||||
common.unique_str(), self.service['id'], common.unique_url(),
|
||||
common.unique_str(),
|
||||
self.service['name'],
|
||||
self.service['type'], common.unique_url(),
|
||||
common.unique_url(), common.unique_url(), True, True)
|
||||
self.post_endpoint_template(as_xml=data, assert_status=403, headers={
|
||||
'Accept': 'application/xml'})
|
||||
|
@ -355,9 +372,10 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
'<endpointTemplate '
|
||||
'xmlns="http://docs.openstack.org/identity'
|
||||
'/api/ext/OSKSCATALOG/v1.0" '
|
||||
'region="%s" serviceId="%s" publicURL="%s" adminURL="%s" '
|
||||
'region="%s" name="%s" type="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>') % (
|
||||
common.unique_str(), self.service['id'], common.unique_url(),
|
||||
common.unique_str(), self.service['name'],
|
||||
self.service['type'], common.unique_url(),
|
||||
common.unique_url(), common.unique_url(), True, True)
|
||||
self.post_endpoint_template(as_xml=data, assert_status=403, headers={
|
||||
'Accept': 'application/xml'})
|
||||
|
@ -368,9 +386,11 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
'<endpointTemplate '
|
||||
'xmlns="http://docs.openstack.org'
|
||||
'/identity/api/ext/OSKSCATALOG/v1.0" '
|
||||
'region="%s" serviceId="%s" publicURL="%s" adminURL="%s" '
|
||||
'region="%s" name="%s" type="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>') % (
|
||||
common.unique_str(), self.service['id'], common.unique_url(),
|
||||
common.unique_str(),
|
||||
self.service['name'], self.service['type'],
|
||||
common.unique_url(),
|
||||
common.unique_url(), common.unique_url(), True, True)
|
||||
self.post_endpoint_template(as_xml=data, assert_status=401, headers={
|
||||
'Accept': 'application/xml'})
|
||||
|
@ -381,9 +401,10 @@ class CreateEndpointRefsTest(EndpointTemplatesTest):
|
|||
'<endpointTemplate '
|
||||
'xmlns="http://docs.openstack.org/'
|
||||
'identity/api/ext/OSKSCATALOG/v1.0" '
|
||||
'region="%s" serviceId="%s" publicURL="%s" adminURL="%s" '
|
||||
'region="%s" name="%s" type="%s" publicURL="%s" adminURL="%s" '
|
||||
'internalURL="%s" enabled="%s" global="%s"/>') % (
|
||||
common.unique_str(), self.service['id'], common.unique_url(),
|
||||
common.unique_str(), self.service['name'],
|
||||
self.service['type'], common.unique_url(),
|
||||
common.unique_url(), common.unique_url(), True, True)
|
||||
self.post_endpoint_template(as_xml=data, assert_status=401, headers={
|
||||
'Accept': 'application/xml'})
|
||||
|
|
|
@ -182,8 +182,8 @@ class DeleteServiceTest(ServicesTest):
|
|||
user = self.create_user(tenant_id=tenant['id']).json['user']
|
||||
|
||||
self.grant_role_to_user(user['id'], role['id'], tenant['id'])
|
||||
self.create_endpoint_template(service_id=self.service['id'])
|
||||
|
||||
self.create_endpoint_template(name=self.service['name'],
|
||||
type=self.service['type'])
|
||||
self.remove_service(self.service['id'], assert_status=204)
|
||||
|
||||
def test_service_delete_json_using_expired_token(self):
|
||||
|
|
Loading…
Reference in New Issue