def test_projects(self):
fileBackend = file_backend.FileBackend(os.tmpnam())
backend = cache_backend.LazyCacheBackend(fileBackend)
+
test_backend.exercise_projects(backend)
- # Confirm cache matches actual
- fileProjects = list(fileBackend.get_projects())
- fileProjects.sort()
- cacheProjects = list(backend.get_projects())
- cacheProjects.sort()
- assert fileProjects == cacheProjects
+ test_backend.assert_projects_same(fileBackend, backend)
def test_locations(self):
fileBackend = file_backend.FileBackend(os.tmpnam())
backend = cache_backend.LazyCacheBackend(fileBackend)
+
test_backend.exercise_locations(backend)
- # Confirm cache matches actual
- fileLocations = list(fileBackend.get_locations())
- fileLocations.sort()
- cacheLocations = list(backend.get_locations())
- cacheLocations.sort()
- assert fileLocations == cacheLocations
+ 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)