Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)