def __init__(self, mapper): services_resource = cfapi.create_resource() mapper.connect('/v2/catalog', controller=services_resource, action='list', conditions={'method': ['GET']}) mapper.connect(('/v2/service_instances/{instance_id}'), controller=services_resource, action='provision', conditions={'method': ['PUT']}) mapper.connect(('/v2/service_instances/{instance_id}'), controller=services_resource, action='deprovision', conditions={'method': ['DELETE']}) mapper.connect(('/v2/service_instances/{instance_id}/service_bindings/' '{app_id}'), controller=services_resource, action='bind', conditions={'method': ['PUT']}) mapper.connect(('/v2/service_instances/{instance_id}/service_bindings/' '{app_id}'), controller=services_resource, action='unbind', conditions={'method': ['DELETE']}) mapper.connect(('/v2/service_instances/{instance_id}/last_operation'), controller=services_resource, action='get_last_operation', conditions={'method': ['GET']}) super(API, self).__init__(mapper)
def test_resource(self): self.assertIsInstance(api.create_resource(), wsgi.Resource)