summaryrefslogtreecommitdiff
path: root/tests/test_logs.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-01-09 11:46:58 -0200
committerdrebs <drebs@leap.se>2013-01-09 11:46:58 -0200
commit8e32fdb0be5d34c6554a8c0f75bdf8bf0debcd4a (patch)
treed3b26ee128674b1484db12f7f421facb8724f676 /tests/test_logs.py
parent11d4d9ece76260639d2c2815b694d6cd68109965 (diff)
CouchDatabase passes u1db LocalDatabaseTests.
Diffstat (limited to 'tests/test_logs.py')
-rw-r--r--tests/test_logs.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/test_logs.py b/tests/test_logs.py
index 072ac1a5..7fbb1cb7 100644
--- a/tests/test_logs.py
+++ b/tests/test_logs.py
@@ -1,5 +1,5 @@
import unittest2 as unittest
-from leap.soledad.util import TransactionLog, SyncLog
+from leap.soledad.util import TransactionLog, SyncLog, ConflictLog
class LogTestCase(unittest.TestCase):
@@ -49,25 +49,37 @@ class LogTestCase(unittest.TestCase):
def test_whats_changed(self):
data = [
- (2, "doc_3", "tran_3"),
- (3, "doc_2", "tran_2"),
- (1, "doc_1", "tran_1")
- ]
+ (1, "doc_1", "tran_1"),
+ (2, "doc_2", "tran_2"),
+ (3, "doc_3", "tran_3")
+ ]
log = TransactionLog()
log.log = data
self.assertEqual(
log.whats_changed(3),
- (3, "tran_2", []),
+ (3, "tran_3", []),
'error getting whats changed.')
self.assertEqual(
log.whats_changed(2),
- (3, "tran_2", [("doc_2",3,"tran_2")]),
+ (3, "tran_3", [("doc_3",3,"tran_3")]),
'error getting whats changed.')
self.assertEqual(
log.whats_changed(1),
- (3, "tran_2", [("doc_3",2,"tran_3"),("doc_2",3,"tran_2")]),
+ (3, "tran_3", [("doc_2",2,"tran_2"),("doc_3",3,"tran_3")]),
'error getting whats changed.')
+ def test_conflict_log(self):
+ data = [('1', 'my:1', 'irrelevant'),
+ ('2', 'my:1', 'irrelevant'),
+ ('3', 'my:1', 'irrelevant')]
+ log = ConflictLog()
+ log.log = data
+ log.delete_conflicts([('1','my:1'),('2','my:1')])
+ self.assertEqual(
+ log.log,
+ [('3', 'my:1', 'irrelevant')],
+ 'error deleting conflicts.')
+
if __name__ == '__main__':
unittest.main()