X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=tests%2Ftodos.py;h=b73f5d7fcb7b0a2c53256593e8e9867e86d2b89e;hb=HEAD;hp=8b8099f509a70029b45a24cef229cca162985e73;hpb=e87f540aa7b550881462cb88380a773b328c0a3d;p=plomtask diff --git a/tests/todos.py b/tests/todos.py index 8b8099f..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) @@ -274,7 +280,7 @@ class TestsWithServer(TestCaseWithServer): '/day?date=2024-01-01&make_type=full', 302) # test posting to bad URLs self.check_post({}, '/todo=', 404) - self.check_post({}, '/todo?id=', 400) + self.check_post({}, '/todo?id=', 404) self.check_post({}, '/todo?id=FOO', 400) self.check_post({}, '/todo?id=0', 404) # test posting naked entity @@ -400,12 +406,15 @@ class TestsWithServer(TestCaseWithServer): form_data = {'day_comment': '', 'new_todo': [1], 'make_type': 'full'} 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] - form_data = {'day_comment': '', 'todo_id': [1], 'make_type': 'full'} + 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'} + '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: @@ -413,8 +422,8 @@ class TestsWithServer(TestCaseWithServer): self.post_process() form_data = {'day_comment': '', 'new_todo': 1, 'make_type': 'full'} self.check_post(form_data, '/day?date=2024-01-01&make_type=full', 302) - self.check_get('/todo', 400) - self.check_get('/todo?id=', 400) + self.check_get('/todo', 404) + self.check_get('/todo?id=', 404) self.check_get('/todo?id=foo', 400) self.check_get('/todo?id=0', 404) self.check_get('/todo?id=1', 200)