From: Ed Page Date: Sat, 18 Apr 2009 22:12:46 +0000 (-0500) Subject: More tests, more bug fixes X-Git-Url: http://git.maemo.org/git/?p=doneit;a=commitdiff_plain;h=04db0d5fa1c8fd6975ba4b898ff0e37407f74cb0 More tests, more bug fixes --- diff --git a/src/cache_backend.py b/src/cache_backend.py index c9968ff..bc0d6be 100644 --- a/src/cache_backend.py +++ b/src/cache_backend.py @@ -70,7 +70,6 @@ class LazyCacheBackend(object): taskId = self._backend.add_task(projId, taskName) self._invalidate_projects_tasks(projId) self._invalidate_metaprojects_tasks() - self._taskIdToProjId[taskId] = projId return taskId def set_project(self, taskId, newProjId): diff --git a/tests/test_cache_backend.py b/tests/test_cache_backend.py index bd2d35d..6d163b9 100644 --- a/tests/test_cache_backend.py +++ b/tests/test_cache_backend.py @@ -14,26 +14,23 @@ class TestCacheBackend(object): def test_projects(self): fileBackend = file_backend.FileBackend(os.tmpnam()) backend = cache_backend.LazyCacheBackend(fileBackend) - test_backend.exercise_projects(backend) - test_backend.assert_projects_same(fileBackend, backend) + # Confirm cache matches actual + fileProjects = list(fileBackend.get_projects()) + fileProjects.sort() + cacheProjects = list(backend.get_projects()) + cacheProjects.sort() + assert fileProjects == cacheProjects def test_locations(self): fileBackend = file_backend.FileBackend(os.tmpnam()) backend = cache_backend.LazyCacheBackend(fileBackend) - test_backend.exercise_locations(backend) - test_backend.assert_locations_same(fileBackend, backend) - - def test_task(self): - fileBackend = file_backend.FileBackend(os.tmpnam()) - backend = cache_backend.LazyCacheBackend(fileBackend) - proj1Id = backend.add_project("p1") - proj2Id = backend.add_project("p2") - - test_backend.exercise_task(backend, proj1Id, proj2Id) - - test_backend.assert_tasks_same(fileBackend, backend, proj1Id) - test_backend.assert_tasks_same(fileBackend, backend, proj2Id) + # Confirm cache matches actual + fileLocations = list(fileBackend.get_locations()) + fileLocations.sort() + cacheLocations = list(backend.get_locations()) + cacheLocations.sort() + assert fileLocations == cacheLocations diff --git a/tests/test_file_backend.py b/tests/test_file_backend.py index da18980..8fefb83 100644 --- a/tests/test_file_backend.py +++ b/tests/test_file_backend.py @@ -16,9 +16,3 @@ class TestFileBackend(object): def test_locations(self): backend = file_backend.FileBackend(os.tmpnam()) test_backend.exercise_locations(backend) - - def test_task(self): - backend = file_backend.FileBackend(os.tmpnam()) - proj1Id = backend.add_project("p1") - proj2Id = backend.add_project("p2") - test_backend.exercise_task(backend, proj1Id, proj2Id)