• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_common.add_user_json函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_common.add_user_json函数的典型用法代码示例。如果您正苦于以下问题:Python add_user_json函数的具体用法?Python add_user_json怎么用?Python add_user_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了add_user_json函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_role_ref_create_xml

 def test_role_ref_create_xml(self):
     utils.add_user_json(self.auth_token)
     resp, _content = utils.create_role_ref_xml(
         self.user, 'Admin', self.tenant,
             str(self.auth_token))
     resp_val = int(resp['status'])
     self.assertEqual(201, resp_val)
开发者ID:Cerberus98,项目名称:keystone,代码行数:7,代码来源:test_roles.py


示例2: test_delete_roleref_using_invalid_token

 def test_delete_roleref_using_invalid_token(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.auth_token)
     resp, content = utils.create_role_ref(self.user, "Admin", self.tenant, str(self.auth_token))
     resp_val = int(resp["status"])
     self.assertEqual(201, resp_val)
     obj = json.loads(content)
     if not "roleRef" in obj:
         raise fault.BadRequestFault("Expecting RoleRef")
     roleRef = obj["roleRef"]
     if not "id" in roleRef:
         role_ref_id = None
     else:
         role_ref_id = roleRef["id"]
     if role_ref_id is None:
         raise fault.BadRequestFault("Expecting RoleRefId")
     url = "%susers/%s/roleRefs/%s" % (URL_V2, self.user, role_ref_id)
     resp, content = header.request(
         url,
         "DELETE",
         body="",
         headers={"Content-Type": "application/json", "X-Auth-Token": str(self.invalid_token)},
     )
     resp_val = int(resp["status"])
     self.assertEqual(404, resp_val)
开发者ID:Mirantis,项目名称:keystone,代码行数:25,代码来源:test_roles.py


示例3: 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


示例4: test_get_rolerefs_json_using_invalid_token

 def test_get_rolerefs_json_using_invalid_token(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.auth_token)
     _resp, _content = utils.create_role_ref(self.user, "Admin", self.tenant, str(self.auth_token))
     url = "%susers/%s/roleRefs" % (URL_V2, self.user)
     # test for Content-Type = application/json
     resp, _content = header.request(
         url, "GET", body="{}", headers={"Content-Type": "application/json", "X-Auth-Token": str(self.invalid_token)}
     )
     self.assertEqual(404, int(resp["status"]))
开发者ID:Mirantis,项目名称:keystone,代码行数:10,代码来源:test_roles.py


示例5: test_get_rolerefs_using_missing_token

 def test_get_rolerefs_using_missing_token(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.auth_token)
     _resp, _content = utils.create_role_ref(self.user, 'Admin',
         self.tenant, str(self.auth_token))
     url = '%susers/%s/roleRefs' % (URL_V2, self.user)
     #test for Content-Type = application/json
     resp, _content = header.request(url, "GET", body='{}', headers={
         "Content-Type": "application/json",
         "X-Auth-Token": str(self.missing_token)})
     self.assertEqual(401, int(resp['status']))
开发者ID:Cerberus98,项目名称:keystone,代码行数:11,代码来源:test_roles.py


示例6: 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


示例7: 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


示例8: test_get_rolerefs_using_invalid_token

 def test_get_rolerefs_using_invalid_token(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.tenant, self.user, self.auth_token)
     resp, content = utils.create_role_ref(self.user, 'Admin', self.tenant,
         str(self.auth_token))
     url = '%susers/%s/roleRefs' % (URL, self.user)
     #test for Content-Type = application/json
     resp, content = header.request(url, "GET", body='{}',
                               headers={"Content-Type": "application/json",
                                      "X-Auth-Token": str(self.invalid_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:jakedahn,项目名称:keystone,代码行数:15,代码来源:test_roles.py


示例9: test_get_rolerefs

    def test_get_rolerefs(self):
        header = httplib2.Http(".cache")
        utils.add_user_json(self.auth_token)
        _resp, _content = utils.create_role_ref(self.user, "Admin", self.tenant, str(self.auth_token))
        url = "%susers/%s/roleRefs" % (URL_V2, self.user)
        # test for Content-Type = application/json
        resp, content = header.request(
            url, "GET", body="{}", headers={"Content-Type": "application/json", "X-Auth-Token": str(self.auth_token)}
        )
        self.assertEqual(200, int(resp["status"]))

        # verify content
        obj = json.loads(content)
        if not "roleRefs" in obj:
            raise self.fail("Expecting RoleRefs")
开发者ID:Mirantis,项目名称:keystone,代码行数:15,代码来源:test_roles.py


示例10: test_get_rolerefs

 def test_get_rolerefs(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.tenant, self.user, self.auth_token)
     resp, content = utils.create_role_ref(self.user, 'Admin', self.tenant,
         str(self.auth_token))
     url = '%susers/%s/roleRefs' % (URL, self.user)
     #test for Content-Type = application/json
     resp, content = header.request(url, "GET", body='{}',
                               headers={"Content-Type": "application/json",
                                      "X-Auth-Token": str(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']))
     
     #verify content
     obj = json.loads(content)
     if not "roleRefs" in obj:
         raise self.fail("Expecting RoleRefs")
开发者ID:jakedahn,项目名称:keystone,代码行数:20,代码来源:test_roles.py


示例11: test_get_rolerefs_xml_using_service_admin_token

 def test_get_rolerefs_xml_using_service_admin_token(self):
     header = httplib2.Http(".cache")
     utils.add_user_json(self.auth_token)
     _resp, _content = utils.create_role_ref(
         self.user, 'Admin', self.tenant,
             str(self.auth_token))
     url = '%susers/%s/roleRefs' % (URL_V2, self.user)
     #test for Content-Type = application/xml
     resp, content = header.request(url, "GET", body='{}',
         headers={"Content-Type": "application/xml",
         "X-Auth-Token": str(self.service_token),
         "ACCEPT": "application/xml"})
     self.assertEqual(200, int(resp['status']))
     #verify content
     dom = etree.Element("root")
     dom.append(etree.fromstring(content))
     roles = dom.find("{http://docs.openstack.org/identity/api/v2.0}" \
         "roleRefs")
     if roles == None:
         self.fail("Expecting Role Refs")
开发者ID:Cerberus98,项目名称:keystone,代码行数:20,代码来源:test_roles.py


示例12: 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


示例13: test_role_ref_create_json_using_invalid_token

 def test_role_ref_create_json_using_invalid_token(self):
     utils.add_user_json(self.tenant, self.user, self.auth_token)
     resp, content = utils.create_role_ref(self.user, 'Admin', self.tenant,
         str(self.invalid_token))
     resp_val = int(resp['status'])
     self.assertEqual(404, resp_val)
开发者ID:jakedahn,项目名称:keystone,代码行数:6,代码来源:test_roles.py


示例14: test_role_ref_create_json_using_missing_token

 def test_role_ref_create_json_using_missing_token(self):
     utils.add_user_json(self.auth_token)
     resp, _content = utils.create_role_ref(self.user, "Admin", self.tenant, str(self.missing_token))
     resp_val = int(resp["status"])
     self.assertEqual(401, resp_val)
开发者ID:Mirantis,项目名称:keystone,代码行数:5,代码来源:test_roles.py



注:本文中的test_common.add_user_json函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_common.content_type函数代码示例发布时间:2022-05-27
下一篇:
Python test_common.add_user_global_group函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap