X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=tests%2Ftodos.py;h=6ce5d6955be068355285c1532e12cd3ffb9e4204;hb=85c260d1416340274b954175a69563868f481bc5;hp=059bd9f4fb47fac79a710b8421995f3f4b869da1;hpb=ec2996e0036ceec72a1be79cea1166c4ab116582;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):