def setUp(self): super(DirectCloudTestCase, self).setUp() compute_handle = compute.API(network_api=self.cloud.network_api, volume_api=self.cloud.volume_api) direct.register_service('compute', compute_handle) self.router = direct.JsonParamsMiddleware(direct.Router()) proxy = direct.Proxy(self.router) self.cloud.compute_api = proxy.compute
def setUp(self): super(DirectCloudTestCase, self).setUp() compute_handle = compute.API(image_service=self.cloud.image_service) volume_handle = volume.API() network_handle = network.API() direct.register_service('compute', compute_handle) direct.register_service('volume', volume_handle) direct.register_service('network', network_handle) self.router = direct.JsonParamsMiddleware(direct.Router()) proxy = direct.Proxy(self.router) self.cloud.compute_api = proxy.compute self.cloud.volume_api = proxy.volume self.cloud.network_api = proxy.network compute_handle.volume_api = proxy.volume compute_handle.network_api = proxy.network
def test_proxy(self): proxy = direct.Proxy(self.router) rv = proxy.fake.echo(self.context, data='baz') self.assertEqual(rv['data'], 'baz')