class TestsWithDB(TestCaseWithDB, TestCaseSansDB):
"""Tests requiring DB, but not server setup.
- NB: We subclass TestCaseSansDB too, to pull in its .test_id_setting, which
- for Todo wouldn't run without a DB being set up due to the need for
+ NB: We subclass TestCaseSansDB too, to pull in its .test_id_validation,
+ which for Todo wouldn't run without a DB being set up due to the need for
Processes with set IDs.
"""
checked_class = Todo
'date': '2024-01-01'}
# solely used for TestCaseSansDB.test_id_setting
default_init_args = [None, False, '2024-01-01']
- do_id_test = True
def setUp(self) -> None:
super().setUp()
self.assertEqual(todo_yes_id.enables, [])
self.assertEqual(todo_yes_id.disables, [])
- def test_Todo_by_id(self) -> None:
- """Test findability of Todos."""
- todo = Todo(1, self.proc, False, self.date1)
- todo.save(self.db_conn)
- self.assertEqual(Todo.by_id(self.db_conn, 1), todo)
- with self.assertRaises(NotFoundException):
- Todo.by_id(self.db_conn, 0)
- with self.assertRaises(NotFoundException):
- Todo.by_id(self.db_conn, 2)
-
def test_Todo_by_date(self) -> None:
"""Test findability of Todos by date."""
t1 = Todo(None, self.proc, False, self.date1)