From de3590c3950b98719aa2a91533f73d9f46124812 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 24 Aug 2015 11:35:41 -0300 Subject: [tests] add missing sync tests to sqlcipher Some tests from the original u1db.tests.test_sync.SQLCipherDatabaseSyncTests were missing, this commit adds them back to the soledad sqlcipher tests. --- .../soledad/common/tests/test_sqlcipher_sync.py | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py b/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py index 5a68f8b6..9f9083af 100644 --- a/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py +++ b/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py @@ -497,6 +497,35 @@ class SQLCipherDatabaseSyncTests( self.assertGetDocIncludeDeleted( self.db3, doc_id, deleted_rev, None, False) + def test_sync_propagates_deletes_2(self): + self.db1 = self.create_database('test1', 'source') + self.db2 = self.create_database('test2', 'target') + self.db1.create_doc_from_json('{"a": "1"}', doc_id='the-doc') + self.sync(self.db1, self.db2) + doc1_2 = self.db2.get_doc('the-doc') + self.db2.delete_doc(doc1_2) + self.sync(self.db1, self.db2) + self.assertGetDocIncludeDeleted( + self.db1, 'the-doc', doc1_2.rev, None, False) + + def test_sync_detects_identical_replica_uid(self): + self.db1 = self.create_database('test1', 'source') + self.db2 = self.create_database('test1', 'target') + self.db1.create_doc_from_json(tests.simple_doc, doc_id='doc1') + self.assertRaises( + errors.InvalidReplicaUID, self.sync, self.db1, self.db2) + + def test_optional_sync_preserve_json(self): + self.db1 = self.create_database('test1', 'source') + self.db2 = self.create_database('test2', 'target') + cont1 = '{ "a": 2 }' + cont2 = '{ "b":3}' + self.db1.create_doc_from_json(cont1, doc_id="1") + self.db2.create_doc_from_json(cont2, doc_id="2") + self.sync(self.db1, self.db2) + self.assertEqual(cont1, self.db2.get_doc("1").get_json()) + self.assertEqual(cont2, self.db1.get_doc("2").get_json()) + def test_sync_propagates_resolution(self): """ Test if synchronization propagates resolution. -- cgit v1.2.3