- todo = Todo(None, process_unsaved, False, self.date1)
- process_unsaved.save(self.db_conn)
- todo = Todo(None, process_unsaved, False, self.date1)
+ Todo(None, process, False, self.date1)
+ process.save(self.db_conn)
+ assert isinstance(self.cond1.id_, int)
+ assert isinstance(self.cond2.id_, int)
+ process.set_conditions(self.db_conn, [self.cond1.id_, self.cond2.id_])
+ process.set_enables(self.db_conn, [self.cond1.id_])
+ process.set_disables(self.db_conn, [self.cond2.id_])
+ todo_no_id = Todo(None, process, False, self.date1)
+ self.assertEqual(todo_no_id.conditions, [self.cond1, self.cond2])
+ self.assertEqual(todo_no_id.enables, [self.cond1])
+ self.assertEqual(todo_no_id.disables, [self.cond2])
+ todo_yes_id = Todo(5, process, False, self.date1)
+ self.assertEqual(todo_yes_id.conditions, [])
+ self.assertEqual(todo_yes_id.enables, [])
+ self.assertEqual(todo_yes_id.disables, [])
+
+ def test_Todo_saving_and_caching(self) -> None:
+ """Test .save."""
+ kwargs = {'id_': 1,
+ 'process': self.proc,
+ 'is_done': False,
+ 'date': self.date1}
+ self.check_saving_and_caching(**kwargs)
+ todo = Todo(None, self.proc, False, self.date1)
+ todo.save(self.db_conn)
+ self.assertEqual(todo.id_, 2)
+
+ def test_Todo_by_id(self) -> None:
+ """Test findability of Todos."""
+ todo = Todo(1, self.proc, False, self.date1)