# Path: glanceclient/tests/utils.py
# class FakeAPI(object):
# class FakeSchemaAPI(FakeAPI):
# class RawRequest(object):
# class FakeResponse(object):
# class TestCase(testtools.TestCase):
# class FakeTTYStdout(io.StringIO):
# class FakeNoTTYStdout(FakeTTYStdout):
#     def __init__(self, fixtures):
#     def _request(self, method, url, headers=None, data=None,
#                  content_length=None):
#     def get(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def patch(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def head(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def __init__(self, headers, body=None,
#                  version=1.0, status=200, reason="Ok"):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def __init__(self, headers=None, body=None,
#                  version=1.0, status_code=200, reason="Ok"):
#     def status(self):
#     def ok(self):
#     def read(self, amt):
#     def close(self):
#     def content(self):
#     def text(self):
#     def json(self, **kwargs):
#     def iter_content(self, chunk_size=1, decode_unicode=False):
#     def release_conn(self, **kwargs):
#     def isatty(self):
#     def write(self, data):
#     def isatty(self):
# def sort_url_by_query_keys(url):
# def build_call_record(method, url, headers, data):
#     TEST_REQUEST_BASE = {
#         'config': {'danger_mode': False},
#         'verify': True}
# 
# 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 jsonpatch
import testtools
import warlock
from glanceclient.tests import utils
from glanceclient.v2 import schemas
        self.assertEqual(raw_schema, schema.raw())

    def test_property_is_base(self):
        raw_schema = {'name': 'Country',
                      'properties': {
                          'size': {},
                          'population': {'is_base': False}}}
        schema = schemas.Schema(raw_schema)
        self.assertTrue(schema.is_base_property('size'))
        self.assertFalse(schema.is_base_property('population'))
        self.assertFalse(schema.is_base_property('foo'))


class TestController(testtools.TestCase):
    def setUp(self):
        super(TestController, self).setUp()
        self.api = utils.FakeAPI(fixtures)
        self.controller = schemas.Controller(self.api)

    def test_get_schema(self):
        schema = self.controller.get('image')
        self.assertEqual('image', schema.name)
        self.assertEqual(set(['name', 'tags']),
                         set([p.name for p in schema.properties]))


class TestSchemaBasedModel(testtools.TestCase):
    def setUp(self):
        super(TestSchemaBasedModel, self).setUp()
        self.model = warlock.model_factory(_SCHEMA.raw(),

# Path: glanceclient/tests/utils.py
# class FakeAPI(object):
# class FakeSchemaAPI(FakeAPI):
# class RawRequest(object):
# class FakeResponse(object):
# class TestCase(testtools.TestCase):
# class FakeTTYStdout(io.StringIO):
# class FakeNoTTYStdout(FakeTTYStdout):
#     def __init__(self, fixtures):
#     def _request(self, method, url, headers=None, data=None,
#                  content_length=None):
#     def get(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def patch(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def head(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def __init__(self, headers, body=None,
#                  version=1.0, status=200, reason="Ok"):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def __init__(self, headers=None, body=None,
#                  version=1.0, status_code=200, reason="Ok"):
#     def status(self):
#     def ok(self):
#     def read(self, amt):
#     def close(self):
#     def content(self):
#     def text(self):
#     def json(self, **kwargs):
#     def iter_content(self, chunk_size=1, decode_unicode=False):
#     def release_conn(self, **kwargs):
#     def isatty(self):
#     def write(self, data):
#     def isatty(self):
# def sort_url_by_query_keys(url):
# def build_call_record(method, url, headers, data):
#     TEST_REQUEST_BASE = {
#         'config': {'danger_mode': False},
#         'verify': True}
# 
# 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/unit/v2/test_schemas.py
import jsonpatch
import testtools
import warlock
from glanceclient.tests import utils
from glanceclient.v2 import schemas

        self.assertEqual(raw_schema, schema.raw())

    def test_property_is_base(self):
        raw_schema = {'name': 'Country',
                      'properties': {
                          'size': {},
                          'population': {'is_base': False}}}
        schema = schemas.Schema(raw_schema)
        self.assertTrue(schema.is_base_property('size'))
        self.assertFalse(schema.is_base_property('population'))
        self.assertFalse(schema.is_base_property('foo'))


class TestController(testtools.TestCase):
    def setUp(self):
        super(TestController, self).setUp()
        self.api = utils.FakeAPI(fixtures)
        self.controller = schemas.Controller(self.api)

    def test_get_schema(self):
        schema = self.controller.get('image')
        self.assertEqual('image', schema.name)
        self.assertEqual(set(['name', 'tags']),
                         set([p.name for p in schema.properties]))


class TestSchemaBasedModel(testtools.TestCase):
    def setUp(self):
        super(TestSchemaBasedModel, self).setUp()
        self.model = warlock.model_factory(_SCHEMA.raw(),

                                           base_class=schemas.SchemaBasedModel)