From: Christian Heller Date: Sat, 22 Jun 2024 02:51:52 +0000 (+0200) Subject: Adapt tests to new cache emptying reality. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/balance?a=commitdiff_plain;h=f89df720c8d827624e3829b1c13bf9f76f301474;p=plomtask Adapt tests to new cache emptying reality. --- diff --git a/tests/processes.py b/tests/processes.py index 9e266e0..2f3ebcc 100644 --- a/tests/processes.py +++ b/tests/processes.py @@ -337,11 +337,11 @@ class TestsWithServer(TestCaseWithServer): self.post_process(1, form_data_1) retrieved_process = Process.by_id(self.db_conn, 1) self.assertEqual(len(retrieved_process.explicit_steps), 2) - retrieved_step_0 = retrieved_process.explicit_steps[0] + retrieved_step_0 = retrieved_process.explicit_steps[1] self.assertEqual(retrieved_step_0.step_process_id, 3) self.assertEqual(retrieved_step_0.owner_id, 1) self.assertEqual(retrieved_step_0.parent_step_id, None) - retrieved_step_1 = retrieved_process.explicit_steps[1] + retrieved_step_1 = retrieved_process.explicit_steps[0] self.assertEqual(retrieved_step_1.step_process_id, 2) self.assertEqual(retrieved_step_1.owner_id, 1) self.assertEqual(retrieved_step_1.parent_step_id, None) @@ -369,11 +369,11 @@ class TestsWithServer(TestCaseWithServer): self.post_process(1, form_data_1) retrieved_process = Process.by_id(self.db_conn, 1) self.assertEqual(len(retrieved_process.explicit_steps), 3) - retrieved_step_0 = retrieved_process.explicit_steps[0] + retrieved_step_0 = retrieved_process.explicit_steps[1] self.assertEqual(retrieved_step_0.step_process_id, 2) self.assertEqual(retrieved_step_0.owner_id, 1) self.assertEqual(retrieved_step_0.parent_step_id, None) - retrieved_step_1 = retrieved_process.explicit_steps[1] + retrieved_step_1 = retrieved_process.explicit_steps[0] self.assertEqual(retrieved_step_1.step_process_id, 3) self.assertEqual(retrieved_step_1.owner_id, 1) self.assertEqual(retrieved_step_1.parent_step_id, None) diff --git a/tests/todos.py b/tests/todos.py index 0998c69..dd57ee4 100644 --- a/tests/todos.py +++ b/tests/todos.py @@ -245,19 +245,25 @@ class TestsWithServer(TestCaseWithServer): form_data = {'day_comment': '', 'make_type': 'full'} self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) self.assertEqual(Todo.by_date(self.db_conn, '2024-01-01'), []) + proc = Process.by_id(self.db_conn, 1) form_data['new_todo'] = str(proc.id_) self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) todos = Todo.by_date(self.db_conn, '2024-01-01') self.assertEqual(1, len(todos)) todo1 = todos[0] self.assertEqual(todo1.id_, 1) + proc = Process.by_id(self.db_conn, 1) self.assertEqual(todo1.process.id_, proc.id_) self.assertEqual(todo1.is_done, False) + proc2 = Process.by_id(self.db_conn, 2) form_data['new_todo'] = str(proc2.id_) self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) todos = Todo.by_date(self.db_conn, '2024-01-01') todo1 = todos[1] self.assertEqual(todo1.id_, 2) + proc2 = Process.by_id(self.db_conn, 1) + todo1 = Todo.by_date(self.db_conn, '2024-01-01')[0] + self.assertEqual(todo1.id_, 1) self.assertEqual(todo1.process.id_, proc2.id_) self.assertEqual(todo1.is_done, False) @@ -403,10 +409,12 @@ class TestsWithServer(TestCaseWithServer): form_data = {'day_comment': '', 'todo_id': [1], 'make_type': 'full', 'comment': [''], 'done': [], 'effort': ['']} self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) + todo = Todo.by_date(self.db_conn, '2024-01-01')[0] self.assertEqual(todo.is_done, False) form_data = {'day_comment': '', 'todo_id': [1], 'done': [1], 'make_type': 'full', 'comment': [''], 'effort': ['']} self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) + todo = Todo.by_date(self.db_conn, '2024-01-01')[0] self.assertEqual(todo.is_done, True) def test_do_GET_todo(self) -> None: