X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=tests%2Ftodos.py;fp=tests%2Ftodos.py;h=6ce5d6955be068355285c1532e12cd3ffb9e4204;hb=31b778276bb7297151f1c90098cc50842c9c138f;hp=059bd9f4fb47fac79a710b8421995f3f4b869da1;hpb=6f44fcfab7927af1800107f9a2ad3ba05e0651f9;p=plomtask diff --git a/tests/todos.py b/tests/todos.py index 059bd9f..6ce5d69 100644 --- a/tests/todos.py +++ b/tests/todos.py @@ -218,6 +218,26 @@ class TestsWithDB(TestCaseWithDB): Todo.by_id(self.db_conn, todo_1.id_) self.assertEqual(todo_0.children, []) self.assertEqual(todo_2.parents, []) + todo_2.comment = 'foo' + with self.assertRaises(HandledException): + todo_2.remove(self.db_conn) + todo_2.comment = '' + todo_2.effort = 5 + with self.assertRaises(HandledException): + todo_2.remove(self.db_conn) + + def test_Todo_autoremoval(self) -> None: + """"Test automatic removal for Todo.effort < 0.""" + todo_1 = Todo(None, self.proc, False, self.date1) + todo_1.save(self.db_conn) + todo_1.comment = 'foo' + todo_1.effort = -0.1 + todo_1.save(self.db_conn) + Todo.by_id(self.db_conn, todo_1.id_) + todo_1.comment = '' + todo_1.save(self.db_conn) + with self.assertRaises(NotFoundException): + Todo.by_id(self.db_conn, todo_1.id_) class TestsWithServer(TestCaseWithServer):