From 8dc3121be6d4d99ce0c43586d8944ca2835fc442 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 8 Nov 2021 19:55:22 +0100 Subject: [PATCH] test get_missing_tasks --- tests/test_utils.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_utils.py diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..a331211 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,27 @@ +import todoist_interface.utils as utils + + +def test_get_missing_tasks(): + """ + Test if the issues_to_check are in the list of tasks + """ + tasks = [{'id': '1', 'content': 'task 1'}, + {'id': '2', 'content': 'task 2'}] + issues_to_check = [{'id': '1', 'content': 'task 1'}, + {'id': '3', 'content': 'task 3'}, + {'id': '2', 'content': 'task 2'}] + missing_should_be = [{'id': '3', 'content': 'task 3'}] + missing_tasks = utils.get_missing_tasks(tasks, issues_to_check) + assert missing_tasks == missing_should_be + + +def test_get_missing_tasks_without_tasks(): + """ + Test if the issues_to_check are in the list of tasks + """ + tasks = [] + issues_to_check = [{'id': '1', 'content': 'task 1'}, + {'id': '3', 'content': 'task 3'}, + {'id': '2', 'content': 'task 2'}] + missing_tasks = utils.get_missing_tasks(tasks, issues_to_check) + assert missing_tasks == issues_to_check