本文整理汇总了Python中test_common.create_global_group函数的典型用法代码示例。如果您正苦于以下问题:Python create_global_group函数的具体用法?Python create_global_group怎么用?Python create_global_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_global_group函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_global_group_create_again
def test_global_group_create_again(self):
respG, contentG = utils.create_global_group(self.global_group, str(self.auth_token))
respG, contentG = utils.create_global_group(self.global_group, str(self.auth_token))
if int(respG["status"]) == 500:
self.fail("IDM fault")
elif int(respG["status"]) == 503:
self.fail("Service Not Available")
self.assertEqual(409, int(respG["status"]))
开发者ID:roarking,项目名称:keystone,代码行数:8,代码来源:test_groups.py
示例2: test_global_group_create_again
def test_global_group_create_again(self):
utils.create_global_group(self.global_group, str(self.auth_token))
resp_new, _content_new = utils.create_global_group(self.global_group,
str(self.auth_token))
if int(resp_new['status']) == 500:
self.fail('Identity fault')
elif int(resp_new['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(409, int(resp_new['status']))
开发者ID:mgius,项目名称:keystone,代码行数:9,代码来源:test_groups.py
示例3: test_update_global_group_not_found
def test_update_global_group_not_found(self):
header = httplib2.Http(".cache")
utils.create_global_group(self.global_group, str(self.auth_token))
url = '%sgroups/NonexistingID' % (utils.URL_V2)
data = '{"group": { "description": "A NEW description...", \
"id":"NonexistingID"}}'
#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})
self.assertEqual(404, int(resp['status']))
开发者ID:mgius,项目名称:keystone,代码行数:11,代码来源:test_groups.py
示例4: test_update_global_group_xml
def test_update_global_group_xml(self):
h = httplib2.Http(".cache")
respG, contentG = utils.create_global_group(self.global_group, str(self.auth_token))
url = "%sgroups/%s" % (utils.URL, self.global_group)
data = (
u'<?xml version="1.0" encoding="UTF-8"?> \
<group xmlns="http://docs.openstack.org/idm/api/v1.0" \
id="%s"><description>A NEW description...</description> \
</group>'
% (self.global_group)
)
# test for Content-Type = application/json
resp, content = h.request(
url,
"PUT",
body=data,
headers={"Content-Type": "application/xml", "X-Auth-Token": self.auth_token, "ACCEPT": "application/xml"},
)
body = etree.fromstring(content)
desc = body.find("{http://docs.openstack.org/idm/api/v1.0}description")
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(str(self.global_group), str(body.get("id")))
self.assertEqual("A NEW description...", desc.text)
开发者ID:roarking,项目名称:keystone,代码行数:29,代码来源:test_groups.py
示例5: test_update_global_group_xml
def test_update_global_group_xml(self):
header = httplib2.Http(".cache")
_resp_new, _content_new = utils.create_global_group(self.global_group,
str(self.auth_token))
url = '%sgroups/%s' % (utils.URL_V2, self.global_group)
data = u'<?xml version="1.0" encoding="UTF-8"?> \
<group xmlns="http://docs.openstack.org/identity/api/v2.0" \
id="%s"><description>A NEW description...</description> \
</group>' % (self.global_group)
#test for Content-Type = application/json
resp, content = header.request(url, "PUT", body=data,
headers={"Content-Type": "application/xml",
"X-Auth-Token": self.auth_token,
"ACCEPT": "application/xml"})
body = etree.fromstring(content)
desc = body.find("{http://docs.openstack.org/identity/api/v2.0}description")
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']))
self.assertEqual(str(self.global_group), str(body.get('id')))
self.assertEqual('A NEW description...', desc.text)
开发者ID:mgius,项目名称:keystone,代码行数:25,代码来源:test_groups.py
示例6: test_add_user_global_group_forbidden_xml
def test_add_user_global_group_forbidden_xml(self):
resp, content = utils.create_global_group(self.global_group, str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
resp_new, content_new = utils.add_user_global_group_xml(self.global_group, self.user, str(self.disabled_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_new["status"]))
开发者ID:juvvadi,项目名称:keystone,代码行数:9,代码来源:test_groups.py
示例7: test_global_group_create_unauthorized_token
def test_global_group_create_unauthorized_token(self):
_header = httplib2.Http(".cache")
resp, _content = utils.create_global_group(\
self.global_group,
str(self.token))
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(401, int(resp['status']))
开发者ID:mgius,项目名称:keystone,代码行数:10,代码来源:test_groups.py
示例8: test_global_group_create
def test_global_group_create(self):
respG, contentG = utils.delete_global_group(self.global_group, str(self.auth_token))
respG, contentG = utils.create_global_group(self.global_group, str(self.auth_token))
if int(respG["status"]) == 500:
self.fail("IDM fault")
elif int(respG["status"]) == 503:
self.fail("Service Not Available")
if int(respG["status"]) not in (200, 201):
self.fail("Failed due to %d" % int(respG["status"]))
开发者ID:roarking,项目名称:keystone,代码行数:10,代码来源:test_groups.py
示例9: test_global_group_create
def test_global_group_create(self):
utils.delete_global_group(self.global_group, str(self.auth_token))
resp_new, _content_new = utils.create_global_group(self.global_group,
str(self.auth_token))
if int(resp_new['status']) == 500:
self.fail('Identity fault')
elif int(resp_new['status']) == 503:
self.fail('Service Not Available')
if int(resp_new['status']) not in (200, 201):
self.fail('Failed due to %d' % int(resp_new['status']))
开发者ID:mgius,项目名称:keystone,代码行数:11,代码来源:test_groups.py
示例10: test_delete_user_global_group_xml
def test_delete_user_global_group_xml(self):
h = httplib2.Http(".cache")
resp, content = utils.create_global_group(self.global_group, str(self.auth_token))
respG, contentG = utils.create_user(self.tenant, self.user, str(self.auth_token))
respG, contentG = utils.add_user_global_group(self.global_group, self.user, str(self.auth_token))
respG, contentG = utils.delete_user_global_group_xml(self.global_group, self.user, 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(204, int(respG["status"]))
开发者ID:roarking,项目名称:keystone,代码行数:11,代码来源:test_groups.py
示例11: test_add_user_global_group_xml
def test_add_user_global_group_xml(self):
resp, content = utils.create_global_group(self.global_group, str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
resp_new, content_new = utils.add_user_global_group_xml(self.global_group, self.user, 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_new["status"]) not in (200, 201):
self.fail("Failed due to %d" % int(resp_new["status"]))
开发者ID:juvvadi,项目名称:keystone,代码行数:11,代码来源:test_groups.py
示例12: test_add_user_global_group
def test_add_user_global_group(self):
h = httplib2.Http(".cache")
resp, content = utils.create_global_group(self.global_group, str(self.auth_token))
respG, contentG = utils.create_user(self.tenant, self.user, str(self.auth_token))
respG, contentG = utils.add_user_global_group(self.global_group, self.user, 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(respG["status"]) not in (200, 201):
self.fail("Failed due to %d" % int(respG["status"]))
开发者ID:roarking,项目名称:keystone,代码行数:12,代码来源:test_groups.py
示例13: test_get_users_global_group_unauthorized
def test_get_users_global_group_unauthorized(self):
resp, content = utils.create_global_group(self.global_group, str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
utils.add_user_global_group(self.global_group, self.user, str(self.auth_token))
resp_new, content_new = utils.get_user_global_group(self.global_group, str(self.token))
if int(resp["status"]) == 500:
self.fail("IDM fault")
elif int(resp["status"]) == 503:
self.fail("Service Not Available")
self.assertEqual(401, int(resp_new["status"]))
开发者ID:juvvadi,项目名称:keystone,代码行数:12,代码来源:test_groups.py
示例14: test_get_global_groups_unauthorized_token
def test_get_global_groups_unauthorized_token(self):
header = httplib2.Http(".cache")
resp_new, content_new = utils.create_global_group(self.global_group, str(self.auth_token))
url = "%sgroups" % (utils.URL)
# 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("IDM fault")
elif int(resp["status"]) == 503:
self.fail("Service Not Available")
self.assertEqual(401, int(resp["status"]))
开发者ID:juvvadi,项目名称:keystone,代码行数:13,代码来源:test_groups.py
示例15: test_get_global_group_bad
def test_get_global_group_bad(self):
h = httplib2.Http(".cache")
respG, contentG = utils.create_global_group(self.global_group, str(self.auth_token))
url = "%sgroups/%s" % (utils.URL, "global_group_bad")
# test for Content-Type = application/json
resp, content = h.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:roarking,项目名称:keystone,代码行数:13,代码来源:test_groups.py
示例16: test_add_user_global_group_forbidden_xml
def test_add_user_global_group_forbidden_xml(self):
resp, _content = utils.create_global_group(self.global_group,
str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
resp_new, _content_new = utils.add_user_global_group_xml(\
self.global_group,
self.user,
str(self.disabled_token))
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(403, int(resp_new['status']))
开发者ID:mgius,项目名称:keystone,代码行数:13,代码来源:test_groups.py
示例17: test_add_user_global_group_unauthorized
def test_add_user_global_group_unauthorized(self):
resp, content = utils.create_global_group(self.global_group,
str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
resp_new, content_new = utils.add_user_global_group(self.global_group,
self.user,
str(self.token))
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(401, int(resp_new['status']))
开发者ID:slashk,项目名称:keystone,代码行数:14,代码来源:test_groups.py
示例18: test_get_global_group_bad
def test_get_global_group_bad(self):
header = httplib2.Http(".cache")
_resp_new, _content_new = utils.create_global_group(self.global_group,
str(self.auth_token))
url = '%sgroups/%s' % (utils.URL_V2, 'global_group_bad')
#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('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(404, int(resp['status']))
开发者ID:mgius,项目名称:keystone,代码行数:14,代码来源:test_groups.py
示例19: test_add_user_global_group
def test_add_user_global_group(self):
resp, _content = utils.create_global_group(self.global_group,
str(self.auth_token))
utils.create_user(self.tenant, self.user, str(self.auth_token))
resp_new, _content_new = utils.add_user_global_group(self.global_group,
self.user,
str(self.auth_token))
if int(resp['status']) == 500:
self.fail('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
if int(resp_new['status']) not in (200, 201):
self.fail('Failed due to %d' % int(resp_new['status']))
开发者ID:mgius,项目名称:keystone,代码行数:14,代码来源:test_groups.py
示例20: test_get_global_groups
def test_get_global_groups(self):
header = httplib2.Http(".cache")
utils.delete_global_group(self.global_group, str(self.auth_token))
resp_new, content_new = utils.create_global_group(self.global_group,
str(self.auth_token))
url = '%sgroups' % (utils.URL)
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('Identity Fault')
elif int(resp['status']) == 503:
self.fail('Service Not Available')
self.assertEqual(200, int(resp['status']))
开发者ID:slashk,项目名称:keystone,代码行数:15,代码来源:test_groups.py
注:本文中的test_common.create_global_group函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论