def create_resource(): return wsgi.Resource(Controller())
def setUp(self): """Run before each test.""" super(LimitsControllerTestV21, self).setUp() self.controller = wsgi.Resource(self.limits_controller()) self.ctrler = self.limits_controller()
def create_resource(ext_mgr): return wsgi.Resource(Controller(ext_mgr))
def create_resource(): return wsgi.Resource(VersionV2())
def create_resource(): return wsgi.Resource(SnapshotsController())
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)
def test_is_valid_body_no_entity(self): resource = wsgi.Resource(controller=None) body = {'bar': {}} self.assertFalse(self.controller.is_valid_body(body, 'foo'))
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'))
def test_is_valid_body_none(self): wsgi.Resource(controller=None) self.assertFalse(self.controller.is_valid_body(None, 'foo'))
def test_is_valid_body_empty(self): resource = wsgi.Resource(controller=None) self.assertFalse(self.controller.is_valid_body({}, 'foo'))
def create_resource(): body_serializers = { 'application/xml': ConsoleXMLSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) return wsgi.Resource(Controller(), serializer=serializer)
def create_resource(): return wsgi.Resource(VolumeTypesController())
def create_resource(ext_mgr): return wsgi.Resource(SnapshotsController(ext_mgr))
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)
def create_volume_resource(ext_mgr): return wsgi.Resource(FakeController(ext_mgr))