当前位置: 首页>>代码示例>>Python>>正文


Python fakes.assert_has_keys函数代码示例

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


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


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