Пример #1
0
def create_resource():
    return wsgi.Resource(Controller())
Пример #2
0
 def setUp(self):
     """Run before each test."""
     super(LimitsControllerTestV21, self).setUp()
     self.controller = wsgi.Resource(self.limits_controller())
     self.ctrler = self.limits_controller()
Пример #3
0
def create_resource(ext_mgr):
    return wsgi.Resource(Controller(ext_mgr))
Пример #4
0
def create_resource():
    return wsgi.Resource(VersionV2())
Пример #5
0
def create_resource():
    return wsgi.Resource(SnapshotsController())
Пример #6
0
 def __init__(self, controller, mapper=None):
     if not mapper:
         mapper = routes.Mapper()
     mapper.resource("test", "tests",
                     controller=os_wsgi.Resource(controller))
     super(TestRouter, self).__init__(mapper)
Пример #7
0
 def test_is_valid_body_no_entity(self):
     resource = wsgi.Resource(controller=None)
     body = {'bar': {}}
     self.assertFalse(self.controller.is_valid_body(body, 'foo'))
Пример #8
0
 def test_is_valid_body_malformed_entity(self):
     resource = wsgi.Resource(controller=None)
     body = {'foo': 'bar'}
     self.assertFalse(self.controller.is_valid_body(body, 'foo'))
Пример #9
0
 def test_is_valid_body_none(self):
     wsgi.Resource(controller=None)
     self.assertFalse(self.controller.is_valid_body(None, 'foo'))
Пример #10
0
 def test_is_valid_body_empty(self):
     resource = wsgi.Resource(controller=None)
     self.assertFalse(self.controller.is_valid_body({}, 'foo'))
Пример #11
0
def create_resource():
    body_serializers = {
        'application/xml': ConsoleXMLSerializer(),
    }
    serializer = wsgi.ResponseSerializer(body_serializers)
    return wsgi.Resource(Controller(), serializer=serializer)
Пример #12
0
def create_resource():
    return wsgi.Resource(VolumeTypesController())
Пример #13
0
def create_resource(ext_mgr):
    return wsgi.Resource(SnapshotsController(ext_mgr))
Пример #14
0
def create_resource(version='1.0'):
    controller = {
        '1.0': ControllerV10,
        '1.1': ControllerV11,
    }[version]()

    metadata = {
        "attributes": {
            "server": [
                "id", "imageId", "name", "flavorId", "hostId", "status",
                "progress", "adminPass", "flavorRef", "imageRef"
            ],
            "link": ["rel", "type", "href"],
        },
        "dict_collections": {
            "metadata": {
                "item_name": "meta",
                "item_key": "key"
            },
        },
        "list_collections": {
            "public": {
                "item_name": "ip",
                "item_key": "addr"
            },
            "private": {
                "item_name": "ip",
                "item_key": "addr"
            },
        },
    }

    xmlns = {
        '1.0': wsgi.XMLNS_V10,
        '1.1': wsgi.XMLNS_V11,
    }[version]

    headers_serializer = HeadersSerializer()

    xml_serializer = {
        '1.0': wsgi.XMLDictSerializer(metadata, wsgi.XMLNS_V10),
        '1.1': ServerXMLSerializer(),
    }[version]

    body_serializers = {
        'application/xml': xml_serializer,
    }

    xml_deserializer = {
        '1.0': helper.ServerXMLDeserializer(),
        '1.1': helper.ServerXMLDeserializerV11(),
    }[version]

    body_deserializers = {
        'application/xml': xml_deserializer,
    }

    serializer = wsgi.ResponseSerializer(body_serializers, headers_serializer)
    deserializer = wsgi.RequestDeserializer(body_deserializers)

    return wsgi.Resource(controller, deserializer, serializer)
Пример #15
0
def create_volume_resource(ext_mgr):
    return wsgi.Resource(FakeController(ext_mgr))