def test_get_all(self): """get_all should return a list of all router ids""" self.assertEqual((yield Router.get_all(self.api.router_store)), []) config = self.create_router_config(id='test-uuid1') yield self.api.router_store.save_router(config) self.assertEqual((yield Router.get_all(self.api.router_store)), ['test-uuid1']) config = self.create_router_config(id='test-uuid2') yield self.api.router_store.save_router(config) self.assertEqual((yield Router.get_all(self.api.router_store)), ['test-uuid1', 'test-uuid2'])
def test_get_all(self): """get_all should return a list of all router ids""" self.assertEqual( (yield Router.get_all(self.api.router_store)), []) config = self.create_router_config(id='test-uuid1') yield self.api.router_store.save_router(config) self.assertEqual( (yield Router.get_all(self.api.router_store)), ['test-uuid1']) config = self.create_router_config(id='test-uuid2') yield self.api.router_store.save_router(config) self.assertEqual( (yield Router.get_all(self.api.router_store)), ['test-uuid1', 'test-uuid2'])
def get_router_list(self, request): """List all routers""" d = Router.get_all(self.router_store) d.addCallback(partial(response, request, 'routers retrieved')) return d