def test_get_item(self): j = JSon(config.backend_json['filename']) p = j.get_item(Project, {Project.default: True}) self.assertIsInstance(p, Project) self.assertTrue(p.default) p = j.get_item(Project, {Project.default: False}) self.assertIsInstance(p, Project) self.assertFalse(p.default)
def test_delete_item(self): j = JSon(config.backend_json['filename']) t = Task('new task') t.id = 3 t.category_id=1 key = 'Task.3' j.delete_item(t) j.commit() self.assertNotIn(key, j.data.keys())