+ def test_fail_POST_day(self) -> None:
+ """Test malformed/illegal POST /condition requests."""
+ # check payloads lacking minimum expecteds
+ url = '/day?date=2024-01-01'
+ self.check_post({}, url, 400)
+ self.check_post({'day_comment': ''}, url, 400)
+ self.check_post({'make_type': ''}, url, 400)
+ # to next check illegal new_todo values, we need an actual Process
+ self.post_process(1)
+ # check illegal new_todo values
+ post: dict[str, object]
+ post = {'make_type': '', 'day_comment': '', 'new_todo': ['foo']}
+ self.check_post(post, url, 400)
+ post['new_todo'] = [1, 2] # no Process of .id_=2 exists
+ # to next check illegal old_todo inputs, we need to first post Todo
+ post['new_todo'] = [1]
+ self.check_post(post, url, 302, '/day?date=2024-01-01&make_type=')
+ # check illegal old_todo inputs (equal list lengths though)
+ post = {'make_type': '', 'day_comment': '', 'comment': ['foo'],
+ 'effort': [3.3], 'done': [], 'todo_id': [1]}
+ self.check_post(post, url, 302, '/day?date=2024-01-01&make_type=')
+ post['todo_id'] = [2] # reference to non-existant Process
+ self.check_post(post, url, 404)
+ post['todo_id'] = ['a']
+ self.check_post(post, url, 400)
+ post['todo_id'] = [1]
+ post['done'] = ['foo']
+ self.check_post(post, url, 400)
+ post['done'] = [2] # reference to non-posted todo_id
+ self.check_post(post, url, 400)
+ post['done'] = []
+ post['effort'] = ['foo']
+ self.check_post(post, url, 400)
+ post['effort'] = [None]
+ self.check_post(post, url, 400)
+ post['effort'] = [3.3]
+ # check illegal old_todo inputs: unequal list lengths
+ post['comment'] = []
+ self.check_post(post, url, 400)
+ post['comment'] = ['foo', 'foo']
+ self.check_post(post, url, 400)
+ post['comment'] = ['foo']
+ post['effort'] = []
+ self.check_post(post, url, 400)
+ post['effort'] = [3.3, 3.3]
+ self.check_post(post, url, 400)
+ post['effort'] = [3.3]
+ post['todo_id'] = [1, 1]
+ self.check_post(post, url, 400)
+ post['todo_id'] = [1]
+ # # check valid POST payload on bad paths
+ self.check_post(post, '/day', 400)
+ self.check_post(post, '/day?date=', 400)
+ self.check_post(post, '/day?date=foo', 400)