class TestsWithDB(TestCaseWithDB):
- """Days module tests not requiring DB setup."""
+ """Tests requiring DB, but not server setup."""
def test_Day_by_date(self) -> None:
"""Test Day.by_date()."""
self.assertEqual(Day('2024-01-01').prev_date, '2023-12-31')
self.assertEqual(Day('2023-02-28').next_date, '2023-03-01')
+ def test_Day_singularity(self) -> None:
+ """Test pointers made for single object keep pointing to it."""
+ day = Day('2024-01-01')
+ day.save(self.db_conn)
+ retrieved_day = Day.by_date(self.db_conn, '2024-01-01')
+ day.comment = 'foo'
+ self.assertEqual(retrieved_day.comment, 'foo')
+
class TestsWithServer(TestCaseWithServer):
"""Tests against our HTTP server/handler (and database)."""