def application(environ, start_response): conf = load_configuration('/etc/leap/soledad-server.conf') state = CouchServerState(conf['couch_url']) # WSGI application that may be used by `twistd -web` application = GzipMiddleware(SoledadTokenAuthMiddleware(SoledadApp(state))) return application(environ, start_response)
def make_soledad_server_thread(couch_port): state = CouchServerState('http://127.0.0.1:%d' % couch_port, 'shared', 'tokens') application = GzipMiddleware(SoledadTokenAuthMiddleware(SoledadApp(state))) server = make_server('', 0, application) t = SoledadServerThread(server) return t
def setUp(self): TestCaseWithServer.setUp(self) CouchDBTestCase.setUp(self) self.tempdir = tempfile.mkdtemp(prefix="leap_tests-") self._couch_url = 'http://localhost:' + str(self.wrapper.port) # create the databases CouchDatabase.open_database(urljoin(self._couch_url, 'shared'), create=True, ensure_ddocs=True) CouchDatabase.open_database(urljoin(self._couch_url, 'tokens'), create=True, ensure_ddocs=True) self._state = CouchServerState(self._couch_url, 'shared', 'tokens')
def setUp(self): # the order of the following initializations is crucial because of # dependencies. # XXX explain better CouchDBTestCase.setUp(self) self._couch_url = 'http://localhost:' + str(self.wrapper.port) self.tempdir = tempfile.mkdtemp(prefix="leap_tests-") TestCaseWithServer.setUp(self) # create the databases CouchDatabase.open_database(urljoin(self._couch_url, 'shared'), create=True, ensure_ddocs=True) CouchDatabase.open_database(urljoin(self._couch_url, 'tokens'), create=True, ensure_ddocs=True) self._state = CouchServerState(self._couch_url)
def make_app(self): self.request_state = CouchServerState(self._couch_url, 'shared', 'tokens') return self.make_app_with_state(self.request_state)
def make_app(self): self.request_state = CouchServerState(self._couch_url) return self.make_app_after_state(self.request_state)