def test_get_task_info(self): store = Store(DATABASE) tasks = [task1, task2, task3] for i in tasks: store.add_task(i) expected_task_info = store.make_dict(task1) actual_task_info = store.get_task_info(task1.id) assert actual_task_info == expected_task_info
def finish_task() -> Response: taskid = request.args.get("taskid") store = Store(DATABASE) store.mark_task_as_finished(taskid) try: assert store.get_task_info(taskid)["done"] == 1 return Response(status=200) except AssertionError: return Response(status=500) finally: store.close()
def get_task() -> json: """simple getter method using REST""" store = Store(DATABASE) all_tasks = store.get_all_taskids() taskid = request.args.get("taskid") if taskid == "sample-for-testing": return "passing connection test" if taskid not in all_tasks: return Response(status=404) task = store.get_task_info(taskid) store.close() return jsonify(task)