本文整理汇总了Python中tempest.common.utils.data_utils.rand_url函数的典型用法代码示例。如果您正苦于以下问题:Python rand_url函数的具体用法?Python rand_url怎么用?Python rand_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rand_url函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_update_endpoint
def test_update_endpoint(self):
# Creating an endpoint so as to check update endpoint
# with new values
region1 = data_utils.rand_name('region')
url1 = data_utils.rand_url()
interface1 = 'public'
resp, endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
enabled=True)
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
# Creating service so as update endpoint with new service ID
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
_, service2 =\
self.service_client.create_service(s_name, s_type,
description=s_description)
self.service_ids.append(service2['id'])
# Updating endpoint with new values
region2 = data_utils.rand_name('region')
url2 = data_utils.rand_url()
interface2 = 'internal'
_, endpoint = \
self.client.update_endpoint(endpoint_for_update['id'],
service_id=service2['id'],
interface=interface2, url=url2,
region=region2, enabled=False)
# Asserting if the attributes of endpoint are updated
self.assertEqual(service2['id'], endpoint['service_id'])
self.assertEqual(interface2, endpoint['interface'])
self.assertEqual(url2, endpoint['url'])
self.assertEqual(region2, endpoint['region'])
self.assertEqual('false', str(endpoint['enabled']).lower())
开发者ID:hkumarmk,项目名称:tempest,代码行数:34,代码来源:test_endpoints.py
示例2: test_update_endpoint
def test_update_endpoint(self):
# Creating an endpoint so as to check update endpoint
# with new values
region1 = data_utils.rand_name("region")
url1 = data_utils.rand_url()
interface1 = "public"
endpoint_for_update = self.client.create_endpoint(
self.service_id, interface1, url1, region=region1, enabled=True
)
self.addCleanup(self.client.delete_endpoint, endpoint_for_update["id"])
# Creating service so as update endpoint with new service ID
s_name = data_utils.rand_name("service")
s_type = data_utils.rand_name("type")
s_description = data_utils.rand_name("description")
service2 = self.service_client.create_service(s_name, s_type, description=s_description)
service2 = service2["service"]
self.service_ids.append(service2["id"])
# Updating endpoint with new values
region2 = data_utils.rand_name("region")
url2 = data_utils.rand_url()
interface2 = "internal"
endpoint = self.client.update_endpoint(
endpoint_for_update["id"],
service_id=service2["id"],
interface=interface2,
url=url2,
region=region2,
enabled=False,
)
# Asserting if the attributes of endpoint are updated
self.assertEqual(service2["id"], endpoint["service_id"])
self.assertEqual(interface2, endpoint["interface"])
self.assertEqual(url2, endpoint["url"])
self.assertEqual(region2, endpoint["region"])
self.assertEqual(False, endpoint["enabled"])
开发者ID:tudorvio,项目名称:tempest,代码行数:35,代码来源:test_endpoints.py
示例3: resource_setup
def resource_setup(cls):
super(EndPointsTestJSON, cls).resource_setup()
cls.service_ids = list()
s_name = data_utils.rand_name('service')
s_type = data_utils.rand_name('type')
s_description = data_utils.rand_name('description')
cls.service_data = cls.services_client.create_service(
name=s_name, type=s_type,
description=s_description)['OS-KSADM:service']
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
for i in range(2):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
endpoint = cls.endpoints_client.create_endpoint(
service_id=cls.service_id,
region=region,
publicurl=url,
adminurl=url,
internalurl=url)['endpoint']
# list_endpoints() will return 'enabled' field
endpoint['enabled'] = True
cls.setup_endpoints.append(endpoint)
开发者ID:Tesora,项目名称:tesora-tempest,代码行数:25,代码来源:test_endpoints.py
示例4: test_create_with_enabled_False
def test_create_with_enabled_False(self):
# Enabled should be a boolean, not a string like 'False'
interface = 'public'
url = data_utils.rand_url()
region = data_utils.rand_name('region')
self.assertRaises(exceptions.BadRequest, self.client.create_endpoint,
self.service_id, interface, url, region=region,
force_enabled='False')
开发者ID:BhargavaRegalla,项目名称:tempest,代码行数:8,代码来源:test_endpoints_negative.py
示例5: _assert_update_raises_bad_request
def _assert_update_raises_bad_request(self, enabled):
# Create an endpoint
region1 = data_utils.rand_name('region')
url1 = data_utils.rand_url()
interface1 = 'public'
resp, endpoint_for_update = (
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1, enabled=True))
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
endpoint_for_update['id'], force_enabled=enabled)
开发者ID:BhargavaRegalla,项目名称:tempest,代码行数:13,代码来源:test_endpoints_negative.py
示例6: resource_setup
def resource_setup(cls):
super(EndPointsTestJSON, cls).resource_setup()
cls.service_ids = list()
s_name = data_utils.rand_name("service")
s_type = data_utils.rand_name("type")
s_description = data_utils.rand_name("description")
cls.service_data = cls.service_client.create_service(s_name, s_type, description=s_description)
cls.service_data = cls.service_data["service"]
cls.service_id = cls.service_data["id"]
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
for i in range(2):
region = data_utils.rand_name("region")
url = data_utils.rand_url()
interface = "public"
endpoint = cls.client.create_endpoint(cls.service_id, interface, url, region=region, enabled=True)
cls.setup_endpoints.append(endpoint)
开发者ID:tudorvio,项目名称:tempest,代码行数:18,代码来源:test_endpoints.py
示例7: test_create_list_delete_endpoint
def test_create_list_delete_endpoint(self):
region = data_utils.rand_name("region")
url = data_utils.rand_url()
interface = "public"
endpoint = self.client.create_endpoint(self.service_id, interface, url, region=region, enabled=True)
# Asserting Create Endpoint response body
self.assertIn("id", endpoint)
self.assertEqual(region, endpoint["region"])
self.assertEqual(url, endpoint["url"])
# Checking if created endpoint is present in the list of endpoints
fetched_endpoints = self.client.list_endpoints()
fetched_endpoints_id = [e["id"] for e in fetched_endpoints]
self.assertIn(endpoint["id"], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint["id"])
# Checking whether endpoint is deleted successfully
fetched_endpoints = self.client.list_endpoints()
fetched_endpoints_id = [e["id"] for e in fetched_endpoints]
self.assertNotIn(endpoint["id"], fetched_endpoints_id)
开发者ID:tudorvio,项目名称:tempest,代码行数:19,代码来源:test_endpoints.py
示例8: test_create_list_delete_endpoint
def test_create_list_delete_endpoint(self):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
endpoint = (self.client.create_endpoint(self.service_id, interface,
url, region=region, enabled=True)['endpoint'])
# Asserting Create Endpoint response body
self.assertIn('id', endpoint)
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
# Checking if created endpoint is present in the list of endpoints
fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertIn(endpoint['id'], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint['id'])
# Checking whether endpoint is deleted successfully
fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertNotIn(endpoint['id'], fetched_endpoints_id)
开发者ID:flyingfish007,项目名称:tempest,代码行数:20,代码来源:test_endpoints.py
示例9: resource_setup
def resource_setup(cls):
super(EndPointsTestJSON, cls).resource_setup()
cls.service_ids = list()
s_name = data_utils.rand_name('service')
s_type = data_utils.rand_name('type')
s_description = data_utils.rand_name('description')
cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
cls.service_data = cls.service_data['service']
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
for i in range(2):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
endpoint = (cls.client.create_endpoint(cls.service_id, interface,
url, region=region, enabled=True))['endpoint']
cls.setup_endpoints.append(endpoint)
开发者ID:flyingfish007,项目名称:tempest,代码行数:21,代码来源:test_endpoints.py
示例10: setUpClass
def setUpClass(cls):
super(EndPointsTestJSON, cls).setUpClass()
cls.identity_client = cls.client
cls.client = cls.endpoints_client
cls.service_ids = list()
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
_, cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
for i in range(2):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
resp, endpoint = cls.client.create_endpoint(
cls.service_id, interface, url, region=region, enabled=True)
cls.setup_endpoints.append(endpoint)
开发者ID:armando-migliaccio,项目名称:tempest-1,代码行数:22,代码来源:test_endpoints.py
注:本文中的tempest.common.utils.data_utils.rand_url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论