def test_controller_extension_early(self):
    controller = StubController(response_body)
    res_ext = base_extensions.ResourceExtension('tweedles', controller)
    ext_controller = StubEarlyExtensionController(extension_body)
    extension = StubControllerExtension()
    cont_ext = base_extensions.ControllerExtension(extension, 'tweedles', ext_controller)
    manager = StubExtensionManager(resource_ext=res_ext, controller_ext=cont_ext)
    app = compute.APIRouter(manager)
    request = webob.Request.blank('/fake/tweedles')
    response = request.get_response(app)
    self.assertEqual(200, response.status_int)
    self.assertEqual(extension_body, response.body)
def test_controller_extension_early(self):
    controller = StubController(response_body)
    res_ext = base_extensions.ResourceExtension('tweedles', controller)
    ext_controller = StubEarlyExtensionController(extension_body)
    extension = StubControllerExtension()
    cont_ext = base_extensions.ControllerExtension(extension, 'tweedles', ext_controller)
    manager = StubExtensionManager(resource_ext=res_ext, controller_ext=cont_ext)
    app = compute.APIRouter(manager)
    request = webob.Request.blank('/fake/tweedles')
    response = request.get_response(app)
    self.assertEqual(200, response.status_int)
    self.assertEqual(extension_body, response.body)