Exemplo n.º 1
0
 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()[1]['security_groups'][0]}
     return (202, r)
Exemplo n.º 2
0
 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()[1]['security_groups'][0]}
     return (202, r)
Exemplo n.º 3
0
 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])
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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])
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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': [],
                   'injected_file_content_bytes': 1,
                   'volumes': 2,
                   'gigabytes': 1,
                   'ram': 1,
                   'floating_ips': 1,
                   'instances': 1,
                   'injected_files': 1,
                   'cores': 1}})
Exemplo n.º 8
0
 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': [],
                   'injected_file_content_bytes': 1,
                   'volumes': 2,
                   'gigabytes': 1,
                   'ram': 1,
                   'floating_ips': 1,
                   'instances': 1,
                   'injected_files': 1,
                   'cores': 1}})
Exemplo n.º 9
0
    def put_os_floating_ip_dns_testdomain(self, body, **kw):
        if body['domain_entry']['scope'] == 'private':
            fakes.assert_has_keys(body['domain_entry'],
                                  required=['availability_zone', 'scope'])
        elif body['domain_entry']['scope'] == 'public':
            fakes.assert_has_keys(body['domain_entry'],
                                  required=['project', 'scope'])

        else:
            fakes.assert_has_keys(body['domain_entry'],
                                  required=['project', 'scope'])
        return (205, None)
Exemplo n.º 10
0
    def put_os_floating_ip_dns_testdomain(self, body, **kw):
        if body['domain_entry']['scope'] == 'private':
            fakes.assert_has_keys(body['domain_entry'],
                            required=['availability_zone', 'scope'])
        elif body['domain_entry']['scope'] == 'public':
            fakes.assert_has_keys(body['domain_entry'],
                            required=['project', 'scope'])

        else:
            fakes.assert_has_keys(body['domain_entry'],
                            required=['project', 'scope'])
        return (205, None)
Exemplo n.º 11
0
 def post_os_keypairs(self, body, **kw):
     assert body.keys() == ['keypair']
     fakes.assert_has_keys(body['keypair'],
                           required=['name'])
     r = {'keypair': self.get_os_keypairs()[1]['keypairs'][0]}
     return (202, r)
Exemplo n.º 12
0
 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()[1]['image']['metadata']})
Exemplo n.º 13
0
 def post_images(self, body, **kw):
     assert body.keys() == ['image']
     fakes.assert_has_keys(body['image'], required=['serverId', 'name'])
     return (202, self.get_images_1()[1])
Exemplo n.º 14
0
 def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw):
     fakes.assert_has_keys(body['dns_entry'],
                     required=['ip', 'dns_type'])
     return (205, None)
Exemplo n.º 15
0
 def put_servers_9999(self, body, **kw):
     assert body.keys() == ['server']
     fakes.assert_has_keys(body['server'], optional=['name', 'adminPass'])
     return (204, None)
Exemplo n.º 16
0
 def put_servers_9999(self, body, **kw):
     assert body.keys() == ['server']
     fakes.assert_has_keys(body['server'], optional=['name', 'adminPass'])
     return (204, None)
Exemplo n.º 17
0
 def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw):
     fakes.assert_has_keys(body['dns_entry'],
                           required=['ip', 'dns_type'])
     return (205, None)
Exemplo n.º 18
0
 def post_os_keypairs(self, body, **kw):
     assert body.keys() == ['keypair']
     fakes.assert_has_keys(body['keypair'],
                           required=['name'])
     r = {'keypair': self.get_os_keypairs()[1]['keypairs'][0]}
     return (202, r)
Exemplo n.º 19
0
 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()[1]['image']['metadata']})
Exemplo n.º 20
0
 def post_images(self, body, **kw):
     assert body.keys() == ['image']
     fakes.assert_has_keys(body['image'], required=['serverId', 'name'])
     return (202, self.get_images_1()[1])