示例#1
0
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)
示例#2
0
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
示例#3
0
 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')
示例#4
0
 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)
示例#5
0
 def make_app(self):
     self.request_state = CouchServerState(self._couch_url, 'shared',
                                           'tokens')
     return self.make_app_with_state(self.request_state)
示例#6
0
 def make_app(self):
     self.request_state = CouchServerState(self._couch_url)
     return self.make_app_after_state(self.request_state)