# Path: glanceclient/v2/schemas.py
# class SchemaBasedModel(warlock.Model):
# class SchemaProperty(object):
# class Schema(object):
# class Controller(object):
#     def _make_custom_patch(self, new, original):
#     def patch(self):
#     def __init__(self, name, **kwargs):
# def translate_schema_properties(schema_properties):
#     def __init__(self, raw_schema):
#     def is_core_property(self, property_name):
#     def is_base_property(self, property_name):
#     def _check_property(self, property_name, allow_non_base):
#     def raw(self):
#     def __init__(self, http_client):
#     def get(self, schema_name):


import copy
import io
import json
import testtools
from urllib import parse
from glanceclient.v2 import schemas



class FakeAPI(object):
    def __init__(self, fixtures):
        self.fixtures = fixtures
        self.calls = []

    def _request(self, method, url, headers=None, data=None,
                 content_length=None):
        call = build_call_record(method, sort_url_by_query_keys(url),
                                 headers or {}, data)
        if content_length is not None:
            call = tuple(list(call) + [content_length])
        self.calls.append(call)

        fixture = self.fixtures[sort_url_by_query_keys(url)][method]

        data = fixture[1]
        if isinstance(fixture[1], str):
            try:
                data = json.loads(fixture[1])
            except ValueError:
                data = io.StringIO(fixture[1])

        return FakeResponse(fixture[0], fixture[1]), data

    def get(self, *args, **kwargs):
        return self._request('GET', *args, **kwargs)


# Path: glanceclient/v2/schemas.py
# class SchemaBasedModel(warlock.Model):
# class SchemaProperty(object):
# class Schema(object):
# class Controller(object):
#     def _make_custom_patch(self, new, original):
#     def patch(self):
#     def __init__(self, name, **kwargs):
# def translate_schema_properties(schema_properties):
#     def __init__(self, raw_schema):
#     def is_core_property(self, property_name):
#     def is_base_property(self, property_name):
#     def _check_property(self, property_name, allow_non_base):
#     def raw(self):
#     def __init__(self, http_client):
#     def get(self, schema_name):


# Path: glanceclient/tests/utils.py
import copy
import io
import json
import testtools
from urllib import parse
from glanceclient.v2 import schemas




class FakeAPI(object):
    def __init__(self, fixtures):
        self.fixtures = fixtures
        self.calls = []

    def _request(self, method, url, headers=None, data=None,
                 content_length=None):
        call = build_call_record(method, sort_url_by_query_keys(url),
                                 headers or {}, data)
        if content_length is not None:
            call = tuple(list(call) + [content_length])
        self.calls.append(call)

        fixture = self.fixtures[sort_url_by_query_keys(url)][method]

        data = fixture[1]
        if isinstance(fixture[1], str):
            try:
                data = json.loads(fixture[1])
            except ValueError:
                data = io.StringIO(fixture[1])

        return FakeResponse(fixture[0], fixture[1]), data

    def get(self, *args, **kwargs):
        return self._request('GET', *args, **kwargs)


    def post(self, *args, **kwargs):