1
# Copyright 2012 OpenStack LLC.
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
23
'location': '/v1/images/1',
29
'container_format': 'ovf',
35
'properties': {'a': 'b', 'c': 'd'},
40
'/v1/images/detail': {
47
'properties': {'arch': 'x86_64'},
55
'x-image-meta-id': '1',
56
'x-image-meta-name': 'image-1',
57
'x-image-meta-property-arch': 'x86_64',
66
'container_format': 'ovf',
72
'properties': {'a': 'b', 'c': 'd'},
78
'/v1/images/1/members': {
82
{'member_id': '1', 'can_share': False},
87
'/v1/images/1/members/1': {
98
'/v1/shared-images/1': {
102
{'image_id': '1', 'can_share': False},
109
class FakeAPI(object):
114
def _request(self, method, url, headers=None, body=None):
115
call = (method, url, headers or {}, body)
116
self.calls.append(call)
117
# drop any query params
118
url = url.split('?', 1)[0]
119
return fixtures[url][method]
121
def raw_request(self, *args, **kwargs):
122
return self._request(*args, **kwargs)
124
def json_request(self, *args, **kwargs):
125
return self._request(*args, **kwargs)