- def test_Todo_enablers_disablers(self) -> None:
- """Test Todo.enablers_for_at/disablers_for_at."""
- assert isinstance(self.cond1.id_, int)
- assert isinstance(self.cond2.id_, int)
- todo1 = Todo(None, self.proc, False, self.date1)
- todo1.save(self.db_conn)
- todo1.set_enables(self.db_conn, [self.cond1.id_])
- todo1.set_disables(self.db_conn, [self.cond2.id_])
- todo1.save(self.db_conn)
- todo2 = Todo(None, self.proc, False, self.date1)
- todo2.save(self.db_conn)
- todo2.set_enables(self.db_conn, [self.cond2.id_])
- todo2.save(self.db_conn)
- todo3 = Todo(None, self.proc, False, self.date2)
- todo3.save(self.db_conn)
- todo3.set_enables(self.db_conn, [self.cond2.id_])
- todo3.save(self.db_conn)
- enablers = Todo.enablers_for_at(self.db_conn, self.cond1, self.date1)
- self.assertEqual(enablers, [todo1])
- enablers = Todo.enablers_for_at(self.db_conn, self.cond1, self.date2)
- self.assertEqual(enablers, [])
- disablers = Todo.disablers_for_at(self.db_conn, self.cond1, self.date1)
- self.assertEqual(disablers, [])
- disablers = Todo.disablers_for_at(self.db_conn, self.cond1, self.date2)
- self.assertEqual(disablers, [])
- enablers = Todo.enablers_for_at(self.db_conn, self.cond2, self.date1)
- self.assertEqual(enablers, [todo2])
- enablers = Todo.enablers_for_at(self.db_conn, self.cond2, self.date2)
- self.assertEqual(enablers, [todo3])
- disablers = Todo.disablers_for_at(self.db_conn, self.cond2, self.date1)
- self.assertEqual(disablers, [todo1])
- disablers = Todo.disablers_for_at(self.db_conn, self.cond2, self.date2)
- self.assertEqual(disablers, [])
-