Beispiel #1
0
def copy_memory_database_for_test(test, db):
    # DO NOT COPY OR REUSE THIS CODE OUTSIDE TESTS: COPYING U1DB DATABASES IS
    # THE WRONG THING TO DO, THE ONLY REASON WE DO SO HERE IS TO TEST THAT WE
    # CORRECTLY DETECT IT HAPPENING SO THAT WE CAN RAISE ERRORS RATHER THAN
    # CORRUPT USER DATA. USE SYNC INSTEAD, OR WE WILL SEND NINJA TO YOUR
    # HOUSE.
    new_db = inmemory.InMemoryDatabase(db._replica_uid)
    new_db._transaction_log = db._transaction_log[:]
    new_db._docs = copy.deepcopy(db._docs)
    new_db._conflicts = copy.deepcopy(db._conflicts)
    new_db._indexes = copy.deepcopy(db._indexes)
    new_db._factory = db._factory
    return new_db
Beispiel #2
0
 def _create_database(self, path):
     db = inmemory.InMemoryDatabase(path)
     self._dbs[path] = db
     return db
Beispiel #3
0
 def setUp(self):
     super(TestInMemoryDatabaseInternals, self).setUp()
     self.db = inmemory.InMemoryDatabase('test')
Beispiel #4
0
def make_memory_database_for_test(test, replica_uid):
    return inmemory.InMemoryDatabase(replica_uid)
Beispiel #5
0
 def setUp(self):
     super(TodoStoreTestCase, self).setUp()
     self.db = inmemory.InMemoryDatabase("u1todo")
Beispiel #6
0
def create_memory_database(test, replica_uid):
    return inmemory.InMemoryDatabase(replica_uid)
Beispiel #7
0
 def setUp(self):
     super(TaskTestCase, self).setUp()
     self.db = inmemory.InMemoryDatabase("u1todo")
     self.document = self.db.create_doc(EMPTY_TASK)
Beispiel #8
0
 def setUp(self):
     super(TodoStoreTestCase, self).setUp()
     self.db = inmemory.InMemoryDatabase("cosas")
     self.db.set_document_factory(Task)
Beispiel #9
0
 def setUp(self):
     super(TaskTestCase, self).setUp()
     self.db = inmemory.InMemoryDatabase("cosas")
     self.db.set_document_factory(Task)
     self.document = self.db.create_doc(get_empty_task())
Beispiel #10
0
 def setUp(self):
     super(TestRemoteSyncIntegration, self).setUp()
     self.startServer()
     self.db1 = inmemory.InMemoryDatabase('test1')
     self.db2 = self.request_state._create_database('test2')
Beispiel #11
0
 def setUp(self):
     super(TestDbSync, self).setUp()
     self.startServer()
     self.db = inmemory.InMemoryDatabase('test1')
     self.db2 = self.request_state._create_database('test2.db')