def test_has_prefix(self): """Make sure endpoint URLs include the prefix.""" prefix = "/foo" app = App(prefix=prefix) endpoints(app, "/endpoints") for endpoint in app.endpoints().iterkeys(): self.assertTrue(prefix in endpoint)
def test_endpoints(self): """Make sure hidden functions don't show up in endpoints.""" app = App() @app.expose('/endpoint') @hidden def endpoint(request): return Response() self.assertFalse(app.endpoints())
class GetEndpointsTest(unittest.TestCase): """Test _get_endpoints.""" def setUp(self): self.app = App() def test_endpoints(self): self.app.expose('foo')(lambda request: Response()) self.app.expose('bar')(lambda request: Response()) endpoints = self.app.endpoints() self.assertTrue('GET foo' in endpoints.keys()) self.assertTrue('GET bar' in endpoints.keys())
class EndpointsTest(unittest.TestCase): """Test dream.endpoints()""" def setUp(self): self.app = App() endpoints(self.app, '/endpoints') def test_endpoints(self): self.assertTrue('GET /endpoints' in self.app.endpoints().keys()) def test_endpoints_reponse(self): self.assertTrue(isinstance( self.app.route({'REQUEST_METHOD': 'GET', 'PATH_INFO': '/endpoints'}), HumanReadableJSONResponse))
class EndpointsTest(unittest.TestCase): """Test dream.endpoints()""" def setUp(self): self.app = App() endpoints(self.app, '/endpoints') def test_endpoints(self): self.assertTrue('GET /endpoints' in self.app.endpoints().keys()) def test_endpoints_reponse(self): (request, response) = self.app.route({'REQUEST_METHOD': 'GET', 'PATH_INFO': '/endpoints'}) self.assertTrue(isinstance(response, HumanReadableJSONResponse)) def test_has_prefix(self): """Make sure endpoint URLs include the prefix.""" prefix = "/foo" app = App(prefix=prefix) endpoints(app, "/endpoints") for endpoint in app.endpoints().iterkeys(): self.assertTrue(prefix in endpoint)