def test_task_delete_with_results(self): task_id = self._create_task()['uuid'] db.task_result_create(task_id, {task_id: task_id}, {task_id: task_id}) res = db.task_result_get_all_by_uuid(task_id) self.assertEqual(len(res), 1) db.task_delete(task_id) res = db.task_result_get_all_by_uuid(task_id) self.assertEqual(len(res), 0)
def test_task_get_detailed_last(self): task1 = self._create_task() key = {'name': 'atata'} data = {'a': 'b', 'c': 'd'} db.task_result_create(task1['uuid'], key, data) task1_full = db.task_get_detailed_last() results = task1_full["results"] self.assertEqual(len(results), 1) self.assertEqual(results[0]["key"], key) self.assertEqual(results[0]["data"], data)
def test_task_get_detailed_last(self): task1 = self._create_task() key = {"name": "atata"} data = {"a": "b", "c": "d"} db.task_result_create(task1["uuid"], key, data) task1_full = db.task_get_detailed_last() results = task1_full["results"] self.assertEqual(len(results), 1) self.assertEqual(results[0]["key"], key) self.assertEqual(results[0]["data"], data)
def test_task_result_get_all_by_uuid(self): task1 = self._create_task()['uuid'] task2 = self._create_task()['uuid'] for task_id in (task1, task2): db.task_result_create(task_id, {task_id: task_id}, {task_id: task_id}) for task_id in (task1, task2): res = db.task_result_get_all_by_uuid(task_id) data = {task_id: task_id} self.assertEqual(len(res), 1) self.assertEqual(res[0]['key'], data) self.assertEqual(res[0]['data'], data)
def append_results(self, key, value): db.task_result_create(self.task["uuid"], key, value)
def append_results(self, key, value): db.task_result_create(self.task['uuid'], key, value)