From 3bc6ab2d5ac65c1919e8e6ff627894924e4f98a9 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 27 Dec 2012 11:09:39 -0200 Subject: Fix imports and namespaces --- tests/test_logs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/test_logs.py') diff --git a/tests/test_logs.py b/tests/test_logs.py index d61700f2..072ac1a5 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -1,10 +1,9 @@ import unittest2 as unittest -from soledad.util import TransactionLog, SyncLog +from leap.soledad.util import TransactionLog, SyncLog class LogTestCase(unittest.TestCase): - def test_transaction_log(self): data = [ (2, "doc_3", "tran_3"), -- cgit v1.2.3 From 8e32fdb0be5d34c6554a8c0f75bdf8bf0debcd4a Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 9 Jan 2013 11:46:58 -0200 Subject: CouchDatabase passes u1db LocalDatabaseTests. --- tests/test_logs.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'tests/test_logs.py') 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() -- cgit v1.2.3 From ea6c9852349b9b4894c00967bd2f7b7b7d287136 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 10 Jan 2013 13:18:48 -0200 Subject: CouchDatabase passes all relevant u1db tests. --- tests/test_logs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_logs.py') diff --git a/tests/test_logs.py b/tests/test_logs.py index 7fbb1cb7..2102b671 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -69,10 +69,11 @@ class LogTestCase(unittest.TestCase): 'error getting whats changed.') def test_conflict_log(self): + # TODO: include tests for `get_conflicts` and `has_conflicts`. data = [('1', 'my:1', 'irrelevant'), ('2', 'my:1', 'irrelevant'), ('3', 'my:1', 'irrelevant')] - log = ConflictLog() + log = ConflictLog(None) log.log = data log.delete_conflicts([('1','my:1'),('2','my:1')]) self.assertEqual( -- cgit v1.2.3 From 984a33de1322437e3979e7324ae042daa52d91e9 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 15 Jan 2013 18:52:56 -0200 Subject: Refactor and fix ObjectStore. --- tests/test_logs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_logs.py') diff --git a/tests/test_logs.py b/tests/test_logs.py index 2102b671..a6c6e282 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, ConflictLog +from leap.soledad.backends.objectstore import TransactionLog, SyncLog, ConflictLog class LogTestCase(unittest.TestCase): -- cgit v1.2.3 From 42877891fc5468c674e95384153e68659c51976e Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 16 Jan 2013 11:04:42 -0200 Subject: Couch backend passes test_sync without indexes. --- tests/test_logs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_logs.py') diff --git a/tests/test_logs.py b/tests/test_logs.py index a6c6e282..293425ad 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -1,3 +1,4 @@ +import ipdb import unittest2 as unittest from leap.soledad.backends.objectstore import TransactionLog, SyncLog, ConflictLog @@ -39,7 +40,7 @@ class LogTestCase(unittest.TestCase): (1, 'tran_1'), 'error getting replica gen and trans id') # test setting log.set_replica_gen_and_trans_id('replica_1', 2, 'tran_12') - self.assertEqual(len(log._log), 3, 'error in log size after setting') + self.assertEqual(len(log._data), 3, 'error in log size after setting') self.assertEqual(log.get_replica_gen_and_trans_id('replica_1'), (2, 'tran_12'), 'error setting replica gen and trans id') self.assertEqual(log.get_replica_gen_and_trans_id('replica_2'), -- cgit v1.2.3 From 9a487e87aceddbf656f14961356c74cb7a1de146 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 22 Jan 2013 09:51:08 -0200 Subject: Cleanup tests. --- tests/test_logs.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/test_logs.py') diff --git a/tests/test_logs.py b/tests/test_logs.py index 293425ad..0be0d1f9 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -1,4 +1,3 @@ -import ipdb import unittest2 as unittest from leap.soledad.backends.objectstore import TransactionLog, SyncLog, ConflictLog -- cgit v1.2.3