+ def test_do_POST_todo(self) -> None:
+ """Test POST /todo."""
+ form_data = {'title': '', 'description': '', 'effort': 1}
+ self.check_post(form_data, '/process', 302, '/')
+ form_data = {'comment': '', 'new_todo': 1}
+ self.check_post(form_data, '/day?date=2024-01-01', 302, '/')
+ form_data = {}
+ self.check_post(form_data, '/todo=', 404)
+ self.check_post(form_data, '/todo?id=', 404)
+ self.check_post(form_data, '/todo?id=FOO', 400)
+ self.check_post(form_data, '/todo?id=0', 404)
+ self.check_post(form_data, '/todo?id=1', 302, '/')
+ todo1 = Todo.by_date(self.db_conn, '2024-01-01')[0]
+ self.assertEqual(todo1.children, [])
+ form_data = {'adopt': 'foo'}
+ self.check_post(form_data, '/todo?id=1', 400)
+ form_data = {'adopt': 1}
+ self.check_post(form_data, '/todo?id=1', 400)
+ form_data = {'adopt': 2}
+ self.check_post(form_data, '/todo?id=1', 404)
+ form_data = {'comment': '', 'new_todo': 1}
+ self.check_post(form_data, '/day?date=2024-01-01', 302, '/')
+ form_data = {'adopt': 2}
+ self.check_post(form_data, '/todo?id=1', 302, '/')
+ self.db_conn.cached_todos = {}
+ todo1 = Todo.by_date(self.db_conn, '2024-01-01')[0]
+ todo2 = Todo.by_date(self.db_conn, '2024-01-01')[1]
+ self.assertEqual(todo1.children, [todo2])
+ self.check_post(form_data, '/todo?id=1', 400, '/')
+