示例#1
0
 def test_open_database_with_factory(self):
     temp_dir = self.createTempDir(prefix='u1db-test-')
     path = temp_dir + '/existing.sqlite'
     SQLCipherDatabase(path, PASSWORD)
     db2 = SQLCipherDatabase.open_database(
         path, PASSWORD, create=False,
         document_factory=TestAlternativeDocument)
     doc = db2.create_doc({})
     self.assertTrue(isinstance(doc, SoledadDocument))
示例#2
0
 def test_open_database_create(self):
     temp_dir = self.createTempDir(prefix='u1db-test-')
     path = temp_dir + '/new.sqlite'
     SQLCipherDatabase.open_database(path, PASSWORD, create=True)
     db2 = SQLCipherDatabase.open_database(path, PASSWORD, create=False)
     self.assertIsInstance(db2, SQLCipherDatabase)
示例#3
0
 def ensure_database(self, path):
     """Ensure database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     full_path = self._relpath(path)
     db = SQLCipherDatabase.open_database(full_path, '123', False)
     return db, db._replica_uid
示例#4
0
 def create_database(self, path):
     """Create a database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     return SQLCipherDatabase.open_database(path, '123', True)
示例#5
0
 def open_database(self, path):
     """Open a database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     return SQLCipherDatabase.open_database(path, '123', False)
示例#6
0
 def ensure_database(self, path):
     """Ensure database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     full_path = self._relpath(path)
     db = SQLCipherDatabase.open_database(full_path, '123', False)
     return db, db._replica_uid
示例#7
0
 def create_database(self, path):
     """Create a database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     return SQLCipherDatabase.open_database(path, '123', True)
示例#8
0
 def open_database(self, path):
     """Open a database at the given location."""
     from leap.soledad.client.sqlcipher import SQLCipherDatabase
     return SQLCipherDatabase.open_database(path, '123', False)