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

Python fakes.assert_has_keys函数代码示例

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

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



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

示例1: post_zones

    def post_zones(self, body, **kw):
        assert body.keys() == ["zone"]
        fakes.assert_has_keys(
            body["zone"], required=["api_url", "username", "password"], optional=["weight_offset", "weight_scale"]
        )

        return (202, self.get_zones_1()[1])
开发者ID:rcbops,项目名称:python-novaclient-buildpackage,代码行数:7,代码来源:fakes.py


示例2: post_zones

    def post_zones(self, body, **kw):
        assert body.keys() == ['zone']
        fakes.assert_has_keys(body['zone'],
                        required=['api_url', 'username', 'password'],
                        optional=['weight_offset', 'weight_scale'])

        return (202, self.get_zones_1()[1])
开发者ID:OpenStack-Kha,项目名称:python-novaclient,代码行数:7,代码来源:fakes.py


示例3: post_images_1_metadata

 def post_images_1_metadata(self, body, **kw):
     assert body.keys() == ['metadata']
     fakes.assert_has_keys(body['metadata'],
                           required=['test_key'])
     return (200,
         {},
         {'metadata': self.get_images_1()[2]['image']['metadata']})
开发者ID:iifire,项目名称:python-novaclient,代码行数:7,代码来源:fakes.py


示例4: put_zones_1

 def put_zones_1(self, body, **kw):
     assert body.keys() == ['zone']
     fakes.assert_has_keys(body['zone'], optional=['api_url', 'username',
                                             'password',
                                             'weight_offset',
                                             'weight_scale'])
     return (204, None)
开发者ID:OpenStack-Kha,项目名称:python-novaclient,代码行数:7,代码来源:fakes.py


示例5: post_flavors_1_os_extra_specs

 def post_flavors_1_os_extra_specs(self, body, **kw):
     assert body.keys() == ['extra_specs']
     fakes.assert_has_keys(body['extra_specs'],
                           required=['k1'])
     return (200,
         {},
         {'extra_specs': {"k1": "v1"}})
开发者ID:iifire,项目名称:python-novaclient,代码行数:7,代码来源:fakes.py


示例6: post_os_security_groups

 def post_os_security_groups(self, body, **kw):
     assert body.keys() == ['security_group']
     fakes.assert_has_keys(body['security_group'],
                           required=['name', 'description'])
     r = {'security_group':
             self.get_os_security_groups()[2]['security_groups'][0]}
     return (202, {}, r)
开发者ID:iifire,项目名称:python-novaclient,代码行数:7,代码来源:fakes.py


示例7: put_os_quota_sets_test

 def put_os_quota_sets_test(self, body, **kw):
     assert body.keys() == ["quota_set"]
     fakes.assert_has_keys(body["quota_set"], required=["tenant_id"])
     return (
         200,
         {},
         {"quota_set": {"tenant_id": "test", "metadata_items": [], "shares": 2, "snapshots": 2, "gigabytes": 1}},
     )
开发者ID:pombredanne,项目名称:python-manilaclient,代码行数:8,代码来源:fake_clients.py


示例8: post_os_floating_ip_dns

 def post_os_floating_ip_dns(self, body, **kw):
     fakes.assert_has_keys(body['dns_entry'],
                     required=['name', 'ip', 'dns_type', 'zone'])
     return (205, {'dns_entry':
                   {'ip': body['dns_entry'].get('ip'),
                    'name': body['dns_entry'].get('name'),
                    'type': body['dns_entry'].get('dns_type'),
                    'zone': body['dns_entry'].get('zone')}})
开发者ID:wendy-king,项目名称:x7_client_venv,代码行数:8,代码来源:fakes.py


示例9: post_servers

 def post_servers(self, body, **kw):
     assert body.keys() == ["server"]
     fakes.assert_has_keys(
         body["server"], required=["name", "imageRef", "flavorRef"], optional=["metadata", "personality"]
     )
     if "personality" in body["server"]:
         for pfile in body["server"]["personality"]:
             fakes.assert_has_keys(pfile, required=["path", "contents"])
     return (202, self.get_servers_1234()[1])
开发者ID:rcbops,项目名称:python-novaclient-buildpackage,代码行数:9,代码来源:fakes.py


示例10: post_os_security_group_rules

 def post_os_security_group_rules(self, body, **kw):
     assert body.keys() == ["security_group_rule"]
     fakes.assert_has_keys(
         body["security_group_rule"],
         required=["parent_group_id"],
         optional=["group_id", "ip_protocol", "from_port", "to_port", "cidr"],
     )
     r = {"security_group_rule": self.get_os_security_group_rules()[1]["security_group_rules"][0]}
     return (202, r)
开发者ID:rcbops,项目名称:python-novaclient-buildpackage,代码行数:9,代码来源:fakes.py


示例11: post_servers

 def post_servers(self, body, **kw):
     assert body.keys() == ['server']
     fakes.assert_has_keys(body['server'],
                     required=['name', 'imageRef', 'flavorRef'],
                     optional=['metadata', 'personality'])
     if 'personality' in body['server']:
         for pfile in body['server']['personality']:
             fakes.assert_has_keys(pfile, required=['path', 'contents'])
     return (202, self.get_servers_1234()[1])
开发者ID:OpenStack-Kha,项目名称:python-novaclient,代码行数:9,代码来源:fakes.py


示例12: post_os_security_group_rules

 def post_os_security_group_rules(self, body, **kw):
     assert body.keys() == ['security_group_rule']
     fakes.assert_has_keys(body['security_group_rule'],
         required=['parent_group_id'],
         optional=['group_id', 'ip_protocol', 'from_port',
                   'to_port', 'cidr'])
     r = {'security_group_rule':
         self.get_os_security_group_rules()[2]['security_group_rules'][0]}
     return (202, {}, r)
开发者ID:iifire,项目名称:python-novaclient,代码行数:9,代码来源:fakes.py


示例13: put_os_quota_class_sets_test

 def put_os_quota_class_sets_test(self, body, **kw):
     assert body.keys() == ['quota_class_set']
     fakes.assert_has_keys(body['quota_class_set'],
                           required=['class_name'])
     return (200, {'quota_class_set': {
                   'class_name': 'test',
                   'metadata_items': [],
                   'volumes': 2,
                   'gigabytes': 1}})
开发者ID:megaumi,项目名称:openstack-tbd-scheduler,代码行数:9,代码来源:fakes.py


示例14: post_servers

 def post_servers(self, body, **kw):
     assert set(body.keys()) <= set(['server', 'os:scheduler_hints'])
     fakes.assert_has_keys(body['server'],
                     required=['name', 'imageRef', 'flavorRef'],
                     optional=['metadata', 'personality'])
     if 'personality' in body['server']:
         for pfile in body['server']['personality']:
             fakes.assert_has_keys(pfile, required=['path', 'contents'])
     return (202, {}, self.get_servers_1234()[2])
开发者ID:iifire,项目名称:python-novaclient,代码行数:9,代码来源:fakes.py


示例15: post_accounts_test_account_create_instance

 def post_accounts_test_account_create_instance(self, body, **kw):
     assert body.keys() == ['server']
     fakes.assert_has_keys(body['server'],
                     required=['name', 'imageId', 'flavorId'],
                     optional=['sharedIpGroupId', 'metadata',
                             'personality', 'min_count', 'max_count'])
     if 'personality' in body['server']:
         for pfile in body['server']['personality']:
             fakes.assert_has_keys(pfile, required=['path', 'contents'])
     return (202, self.get_servers_1234()[1])
开发者ID:antonym,项目名称:python-novaclient,代码行数:10,代码来源:fakes.py


示例16: put_os_quota_sets_test

 def put_os_quota_sets_test(self, body, **kw):
     assert body.keys() == ['quota_set']
     fakes.assert_has_keys(body['quota_set'],
                           required=['tenant_id'])
     return (200, {}, {'quota_set': {
                       'tenant_id': 'test',
                       'metadata_items': [],
                       'monitors': 2,
                       'snapshots': 2,
                       'gigabytes': 1}})
开发者ID:52136,项目名称:openstack,代码行数:10,代码来源:fakes.py


示例17: post_shared_ip_groups

 def post_shared_ip_groups(self, body, **kw):
     assert body.keys() == ['sharedIpGroup']
     fakes.assert_has_keys(body['sharedIpGroup'], required=['name'],
                                            optional=['server'])
     return (201, {'sharedIpGroup': {
         'id': 10101,
         'name': body['sharedIpGroup']['name'],
         'servers': 'server' in body['sharedIpGroup'] and \
                    [body['sharedIpGroup']['server']] or None
     }})
开发者ID:antonym,项目名称:python-novaclient,代码行数:10,代码来源:fakes.py


示例18: post_accounts_test_account_create_instance

 def post_accounts_test_account_create_instance(self, body, **kw):
     assert body.keys() == ["server"]
     fakes.assert_has_keys(
         body["server"],
         required=["name", "imageId", "flavorId"],
         optional=["sharedIpGroupId", "metadata", "personality", "min_count", "max_count"],
     )
     if "personality" in body["server"]:
         for pfile in body["server"]["personality"]:
             fakes.assert_has_keys(pfile, required=["path", "contents"])
     return (202, self.get_servers_1234()[1])
开发者ID:cloudnull,项目名称:python-lnovaclient,代码行数:11,代码来源:fakes.py


示例19: post_os_floating_ip_dns

 def post_os_floating_ip_dns(self, body, **kw):
     fakes.assert_has_keys(body["dns_entry"], required=["name", "ip", "dns_type", "zone"])
     return (
         205,
         {
             "dns_entry": {
                 "ip": body["dns_entry"].get("ip"),
                 "name": body["dns_entry"].get("name"),
                 "type": body["dns_entry"].get("dns_type"),
                 "zone": body["dns_entry"].get("zone"),
             }
         },
     )
开发者ID:jakedahn,项目名称:python-novaclient,代码行数:13,代码来源:fakes.py


示例20: post_shared_ip_groups

 def post_shared_ip_groups(self, body, **kw):
     assert body.keys() == ["sharedIpGroup"]
     fakes.assert_has_keys(body["sharedIpGroup"], required=["name"], optional=["server"])
     return (
         201,
         {
             "sharedIpGroup": {
                 "id": 10101,
                 "name": body["sharedIpGroup"]["name"],
                 "servers": "server" in body["sharedIpGroup"] and [body["sharedIpGroup"]["server"]] or None,
             }
         },
     )
开发者ID:cloudnull,项目名称:python-lnovaclient,代码行数:13,代码来源:fakes.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python fixtures.get函数代码示例发布时间:2022-05-27
下一篇:
Python user_factory.create函数代码示例发布时间: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