def main(): """Runs an HTTP server serving items and groups. If 'test' is passed as argument, first run :func:`do_tests` from :mod:`.example1` on the service. """ test = len(argv) > 1 and argv[1] == "test" service_config = get_service_configuration() service_config.set('server', 'port', '1234') service_config.set('server', 'base-path', '/foo') # TODO Store management : special tests ? serv = make_example2_service(service_config) root_uri = serv.root_uri if test: do_tests(serv.get(root_uri)) print "Local tests passed" app = HttpFrontend(serv, service_config) _httpd = make_server(service_config.get('server', 'host-name', 1), service_config.getint('server', 'port'), app) print "Now listening on", root_uri _httpd.serve_forever()
def main(): """Runs an HTTP server serving items and groups. If 'test' is passed as argument, first run :func:`do_tests` from :mod:`.example1` on the service. """ test = len(argv) > 1 and argv[1] == "test" BASE_PATH = '/foo' service_config = get_service_configuration() service_config.set('server', 'port', '1234') service_config.set('server', 'base-path', BASE_PATH) # TODO Store management : special tests ? serv = make_example2_service(service_config) root_uri = serv.root_uri if test: do_tests(serv.get(root_uri)) print "Local tests passed" app = SimpleRouter([(BASE_PATH, HttpFrontend(serv, service_config))]) _httpd = make_server(service_config.get('server', 'host-name', 1), service_config.getint('server', 'port'), app) print "Now listening on", root_uri _httpd.serve_forever()
def main(): """Runs an HTTP server serving items and groups. If 'test' is passed as argument, first run :func:`do_tests` from :mod:`.example1` on the service. """ test = len(argv) > 1 and argv[1] == "test" root_uri = URIRef("http://localhost:1234/foo/") serv = make_example2_service(root_uri) if test: do_tests(serv.get(root_uri)) print "Local tests passed" app = HttpFrontend(serv) _httpd = make_server("localhost", 1234, app) print "Now listening on", root_uri _httpd.serve_forever()
def test_example1(self): """I use the comprehensive test sequence defined in example1.py""" example1.do_tests(self.root)