def _init_shared_db(self): if not self._soledad.server_url: return None url = urlparse.urljoin(self._soledad.server_url, SHARED_DB_NAME) creds = self._creds db = SoledadSharedDatabase.open_database(url, creds) return db
def setUp(self): BaseSoledadTest.setUp(self) self._shared_db = SoledadSharedDatabase( 'https://provider/', ADDRESS, document_factory=SoledadDocument, creds=None)
def _shared_db(self): """ Return an instance of the shared recovery database object. :return: The shared database. :rtype: SoledadSharedDatabase """ if self._shared_db_instance is None: self._shared_db_instance = SoledadSharedDatabase.open_database( urlparse.urljoin(self.server_url, SHARED_DB_NAME), self._uuid, False, # db should exist at this point. creds=self._creds) return self._shared_db_instance
def init_shared_db(self, server_url, uuid, creds, syncable=True): """ Initialize the shared database. :param server_url: URL of the remote database. :type server_url: str :param uuid: The user's unique id. :type uuid: str :param creds: A tuple containing the authentication method and credentials. :type creds: tuple :param syncable: If syncable is False, the database will not attempt to sync against a remote replica. :type syncable: bool """ # only case this is False is for testing purposes if self.shared_db is None: shared_db_url = urlparse.urljoin(server_url, SHARED_DB_NAME) self.shared_db = SoledadSharedDatabase.open_database(shared_db_url, uuid, creds=creds, syncable=syncable)
def init_shared_db(self, server_url, uuid, creds, syncable=True): """ Initialize the shared database. :param server_url: URL of the remote database. :type server_url: str :param uuid: The user's unique id. :type uuid: str :param creds: A tuple containing the authentication method and credentials. :type creds: tuple :param syncable: If syncable is False, the database will not attempt to sync against a remote replica. :type syncable: bool """ # only case this is False is for testing purposes if self.shared_db is None: shared_db_url = urlparse.urljoin(server_url, SHARED_DB_NAME) self.shared_db = SoledadSharedDatabase.open_database( shared_db_url, uuid, creds=creds, syncable=syncable)
def soledad_client(self, soledad_server, soledad_dbs): soledad_dbs('an-uuid') self._db = SoledadSharedDatabase.open_database(self.URL, self.CREDS)