summaryrefslogtreecommitdiff
path: root/common/src/leap
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-08-24 11:35:41 -0300
committerdrebs <drebs@leap.se>2015-08-24 11:35:41 -0300
commitde3590c3950b98719aa2a91533f73d9f46124812 (patch)
tree8f0839028e9627329797d0fac533268ea10d0db6 /common/src/leap
parent2d99ba164e3711af22434dde3be95460eff8b28b (diff)
[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.
Diffstat (limited to 'common/src/leap')
-rw-r--r--common/src/leap/soledad/common/tests/test_sqlcipher_sync.py29
1 files changed, 29 insertions, 0 deletions
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.