本文整理汇总了Python中test_common.create_global_group函数的典型用法代码示例。如果您正苦于以下问题:Python create_global_group函数的具体用法?Python create_global_group怎么用?Python create_global_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_global_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"]))
示例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']))
示例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']))
示例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)
示例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)
示例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"]))
示例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']))
示例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"]))
示例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']))
示例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"]))
示例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"]))
示例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"]))
示例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"]))
示例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"]))
示例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"]))