self.check_post({}, '/todo?id=FOO', 400)
self.check_post({}, '/todo?id=0', 404)
# test posting naked entity
- todo1 = post_and_reload({})
+ todo1 = post_and_reload({'comment': ''})
self.assertEqual(todo1.children, [])
self.assertEqual(todo1.parents, [])
self.assertEqual(todo1.is_done, False)
# test posting doneness
- todo1 = post_and_reload({'done': ''})
+ todo1 = post_and_reload({'done': '', 'comment': ''})
self.assertEqual(todo1.is_done, True)
# test implicitly posting non-doneness
- todo1 = post_and_reload({})
+ todo1 = post_and_reload({'comment': ''})
self.assertEqual(todo1.is_done, False)
# test malformed adoptions
self.check_post({'adopt': 'foo'}, '/todo?id=1', 400)
self.check_post({'day_comment': '', 'new_todo': 1},
'/day?date=2024-01-01', 302)
# test todo 1 adopting todo 2
- todo1 = post_and_reload({'adopt': 2})
+ todo1 = post_and_reload({'adopt': 2, 'comment': ''})
todo2 = Todo.by_date(self.db_conn, '2024-01-01')[1]
self.assertEqual(todo1.children, [todo2])
self.assertEqual(todo1.parents, [])
self.assertEqual(todo2.children, [])
self.assertEqual(todo2.parents, [todo1])
# test todo1 cannot be set done with todo2 not done yet
- todo1 = post_and_reload({'done': '', 'adopt': 2}, 400)
+ todo1 = post_and_reload({'done': '', 'adopt': 2, 'comment': ''}, 400)
self.assertEqual(todo1.is_done, False)
# test todo1 un-adopting todo 2 by just not sending an adopt
- todo1 = post_and_reload({}, 302)
+ todo1 = post_and_reload({'comment': ''}, 302)
todo2 = Todo.by_date(self.db_conn, '2024-01-01')[1]
self.assertEqual(todo1.children, [])
self.assertEqual(todo1.parents, [])