本文整理汇总了Python中test_common.create_tenant函数的典型用法代码示例。如果您正苦于以下问题:Python create_tenant函数的具体用法?Python create_tenant怎么用?Python create_tenant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_tenant函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.auth_token = utils.get_auth_token()
self.userdisabled = utils.get_userdisabled()
utils.create_tenant('test_tenant1', self.auth_token)
utils.create_tenant('test_tenant2', self.auth_token)
utils.create_user('test_tenant1', 'test_user1', self.auth_token)
utils.create_user('test_tenant1', 'test_user2', self.auth_token)
utils.add_user_json(self.auth_token)
开发者ID:Mirantis,项目名称:keystone,代码行数:8,代码来源:test_authentication.py
示例2: test_delete_global_group
def test_delete_global_group(self):
utils.create_tenant(self.globaltenant, str(self.auth_token))
utils.create_tenant_group('test_global_group_delete',
self.globaltenant, str(self.auth_token))
resp_new, _content_new = utils.delete_global_group(\
'test_global_group_delete',
str(self.auth_token))
_resp = utils.delete_tenant(self.globaltenant, str(self.auth_token))
self.assertEqual(204, int(resp_new['status']))
开发者ID:mgius,项目名称:keystone,代码行数:9,代码来源:test_groups.py
示例3: setUp
def setUp(self):
self.tenant = 'test_tenant'
self.auth_token = utils.get_auth_token()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
utils.add_user_json(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, 'secrete', self.tenant,
'token')
开发者ID:juvvadi,项目名称:keystone,代码行数:12,代码来源:test_tenants.py
示例4: setUp
def setUp(self):
self.tenant = utils.get_global_tenant()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.auth_token = utils.get_auth_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
self.global_group = "test_global_group"
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
utils.add_user_json(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, "secrete", self.tenant, "token")
开发者ID:juvvadi,项目名称:keystone,代码行数:12,代码来源:test_groups.py
示例5: test_tenant_create_again
def test_tenant_create_again(self):
resp, content = utils.create_tenant(self.tenant,
str(self.auth_token))
if int(resp['status']) == 200:
self.tenant = content['tenant']['id']
resp, content = utils.create_tenant(self.tenant,
str(self.auth_token))
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(409, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:13,代码来源:test_tenants.py
示例6: setUp
def setUp(self):
self.auth_token = utils.get_auth_token()
self.userdisabled = utils.get_userdisabled()
resp1, content1 = utils.create_tenant('test_tenant1', self.auth_token)
#create tenant2
resp2, content2 = utils.create_tenant('test_tenant2', self.auth_token)
#create user1 with tenant1
resp3, content3 = utils.create_user('test_tenant1', 'test_user1',
self.auth_token)
resp3, content3 = utils.create_user('test_tenant1', 'test_user2',
self.auth_token)
#add user1 to tenant2
resp4, content4 = utils.add_user_json('test_tenant2', 'test_user1',
self.auth_token)
开发者ID:slashk,项目名称:keystone,代码行数:14,代码来源:test_authentication.py
示例7: setUp
def setUp(self):
self.tenant = utils.get_tenant()
self.password = utils.get_password()
self.email = utils.get_email()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.auth_token = utils.get_auth_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
self.missing_token = utils.get_none_token()
self.invalid_token = utils.get_non_existing_token()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, 'secrete', self.tenant,
'token')
开发者ID:aabes,项目名称:keystone,代码行数:15,代码来源:test_BaseURLs.py
示例8: setUp
def setUp(self):
self.auth_token = utils.get_auth_token()
self.service_token = utils.get_service_token()
self.missing_token = utils.get_none_token()
self.invalid_token = utils.get_non_existing_token()
self.disabled_token = utils.get_disabled_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.user = utils.get_user()
self.tenant = utils.get_tenant()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
self.sample_service = 'sampleservice'
self.test_service = 'test_service'
self.token = utils.get_token(self.user, 'secrete', self.tenant,
'token')
utils.create_service(self.sample_service, str(self.auth_token))
开发者ID:Mirantis,项目名称:keystone,代码行数:16,代码来源:test_services.py
示例9: setUp
def setUp(self):
self.tenant = utils.get_tenant()
self.password = utils.get_password()
self.email = utils.get_email()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.auth_token = utils.get_auth_token()
self.service_token = utils.get_service_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
self.missing_token = utils.get_none_token()
self.invalid_token = utils.get_non_existing_token()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, "secrete", self.tenant, "token")
self.service_id = utils.get_test_service_id()
self.service_role = self.service_id + ":test_role"
开发者ID:Mirantis,项目名称:keystone,代码行数:17,代码来源:test_roles.py
示例10: test_tenant_create
def test_tenant_create(self):
resp, content = utils.delete_tenant(self.tenant, str(self.auth_token))
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
if int(resp['status']) not in (200, 201):
self.fail('Failed due to %d' % int(resp['status']))
开发者ID:roarking,项目名称:keystone,代码行数:11,代码来源:test_tenants.py
示例11: test_get_tenants_using_user_token
def test_get_tenants_using_user_token(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants' % (utils.URL_V2)
#test for Content-Type = application/json
resp, content = header.request(url, "GET", body='{}',
headers={"Content-Type": "application/json",
"X-Auth-Token": self.token})
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(200, int(resp['status']))
开发者ID:Cerberus98,项目名称:keystone,代码行数:13,代码来源:test_tenants.py
示例12: test_get_tenant_not_found
def test_get_tenant_not_found(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants/NonexistingID' % (utils.URL)
#test for Content-Type = application/json
resp, content = header.request(url, "GET", body='{}',
headers={"Content-Type": "application/json",
"X-Auth-Token": self.auth_token})
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:13,代码来源:test_tenants.py
示例13: test_get_tenant_bad_xml
def test_get_tenant_bad_xml(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants/%s' % (utils.URL, 'tenant_bad')
#test for Content-Type = application/json
resp, content = header.request(url, "GET", body='',
headers={"Content-Type": "application/xml",
"X-Auth-Token": self.auth_token,
"ACCEPT": "application/xml"})
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:14,代码来源:test_tenants.py
示例14: setUp
def setUp(self):
self.tenant = utils.get_tenant()
self.password = utils.get_password()
self.email = utils.get_email()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.auth_token = utils.get_auth_token()
self.service_token = utils.get_service_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
self.missing_token = utils.get_none_token()
self.invalid_token = utils.get_non_existing_token()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, 'secrete', self.tenant,
'token')
self.region = 'DFW'
self.service = utils.get_test_service_id()
self.public_url = 'public'
self.admin_url = 'admin'
self.internal_url = 'internal'
self.enabled = True
self.is_global = False
开发者ID:Cerberus98,项目名称:keystone,代码行数:23,代码来源:test_endpoints.py
示例15: test_update_tenant_not_found
def test_update_tenant_not_found(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants/NonexistingID' % (utils.URL)
data = '{"tenant": { "description": "A NEW description...",\
"enabled":true }}'
#test for Content-Type = application/json
resp, content = header.request(url, "GET", body=data,
headers={"Content-Type": "application/json",
"X-Auth-Token": self.auth_token})
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:slashk,项目名称:keystone,代码行数:15,代码来源:test_tenants.py
示例16: setUp
def setUp(self):
self.tenant = utils.get_tenant()
self.password = utils.get_password()
self.email = utils.get_email()
self.user = utils.get_user()
self.userdisabled = utils.get_userdisabled()
self.auth_token = utils.get_auth_token()
self.service_token = utils.get_service_token()
self.exp_auth_token = utils.get_exp_auth_token()
self.disabled_token = utils.get_disabled_token()
self.missing_token = utils.get_none_token()
self.invalid_token = utils.get_non_existing_token()
utils.create_tenant(self.tenant, str(self.auth_token))
utils.create_user(self.tenant, self.user, self.auth_token)
self.token = utils.get_token(self.user, 'secrete', self.tenant,
'token')
self.region = 'DFW'
self.service = utils.get_test_service_id()
self.public_url = 'public'
self.admin_url = 'admin'
self.internal_url = 'internal'
self.enabled = True
self.is_global = False
resp, content = utils.create_endpoint_template(\
self.region, self.service, self.public_url,\
self.admin_url, self.internal_url,\
self.enabled, self.is_global, self.auth_token)
self.assertEqual(201, int(resp['status']))
obj = json.loads(content)
if not "endpointTemplate" in obj:
raise fault.BadRequestFault("Expecting endpointTemplate")
endpoint_template = obj["endpointTemplate"]
if not "id" in endpoint_template:
self.endpoint_template_id = None
else:
self.endpoint_template_id = endpoint_template["id"]
开发者ID:vishvananda,项目名称:keystone,代码行数:36,代码来源:test_endpoints.py
示例17: test_tenant_create_expired_token
def test_tenant_create_expired_token(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant,
str(self.auth_token))
if int(resp['status']) == 200:
self.tenant = content['tenant']['id']
url = '%stenants' % (utils.URL)
body = {"tenant": {"id": self.tenant,
"description": "A description ...",
"enabled": True}}
resp, content = header.request(url, "POST", body=json.dumps(body),
headers={"Content-Type": "application/json",
"X-Auth-Token": self.exp_auth_token})
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(403, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:18,代码来源:test_tenants.py
示例18: test_update_tenant
def test_update_tenant(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants/%s' % (utils.URL, self.tenant)
data = '{"tenant": { "description": "A NEW description..." ,\
"enabled":true }}'
#test for Content-Type = application/json
resp, content = header.request(url, "PUT", body=data,
headers={"Content-Type": "application/json",
"X-Auth-Token": self.auth_token})
body = json.loads(content)
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(200, int(resp['status']))
self.assertEqual(self.tenant, body['tenant']['id'])
self.assertEqual('A NEW description...', body['tenant']['description'])
开发者ID:juvvadi,项目名称:keystone,代码行数:18,代码来源:test_tenants.py
示例19: test_update_tenant_not_found_xml
def test_update_tenant_not_found_xml(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant, str(self.auth_token))
url = '%stenants/NonexistingID' % (utils.URL)
data = '<?xml version="1.0" encoding="UTF-8"?> \
<tenant xmlns="http://docs.openstack.org/idm/api/v1.0" \
enabled="true"> \
<description_bad>A NEW description...</description> \
</tenant>'
#test for Content-Type = application/json
resp, content = header.request(url, "GET", body=data,
headers={"Content-Type": "application/xml",
"X-Auth-Token": self.auth_token,
"ACCEPT": "application/xml"})
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:19,代码来源:test_tenants.py
示例20: test_tenant_create_invalid_token
def test_tenant_create_invalid_token(self):
header = httplib2.Http(".cache")
resp, content = utils.create_tenant(self.tenant,
str(self.auth_token))
if int(resp['status']) == 200:
self.tenant = content['tenant']['id']
url = '%stenants' % (utils.URL)
body = '{"tenant": { "id": "%s", \
"description": "A description ...", "enabled"\
:true } }' % self.tenant
resp, content = header.request(url, "POST", body=body,
headers={"Content-Type": "application/json",
"X-Auth-Token": 'nonexsitingtoken'})
if int(resp['status']) == 500:
self.fail('IDM fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:juvvadi,项目名称:keystone,代码行数:20,代码来源:test_tenants.py
注:本文中的test_common.create_tenant函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论