- def test_remove(self) -> None:
- """Test .remove() effects on DB and cache."""
- super().test_remove()
- proc = Process(None)
- proc.save(self.db_conn)
- todo = Todo(None, proc, False, '2024-01-01')
- todo.save(self.db_conn)
- # check condition can only be deleted if not depended upon
- for depender in (proc, todo):
- c = Condition(None)
- c.save(self.db_conn)
- assert isinstance(c.id_, int)
- depender.set_condition_relations(self.db_conn, [c.id_], [], [], [])
- depender.save(self.db_conn)
- with self.assertRaises(HandledException):
- c.remove(self.db_conn)
- depender.set_condition_relations(self.db_conn, [], [], [], [])
- depender.save(self.db_conn)
- c.remove(self.db_conn)
-