home · contact · privacy
Refactor remaining test.utils helpers into actual tests.
[plomtask] / tests / days.py
index 901667f4c6e0276a2800bf4b21b15b03a17be2fb..36d0285296b7b191e4217475a08fb94646ed5207 100644 (file)
@@ -44,27 +44,15 @@ class TestsWithDB(TestCaseWithDB):
     checked_class = Day
     default_ids = ('2024-01-01', '2024-01-02', '2024-01-03')
 
-    def test_saving_and_caching(self) -> None:
-        """Test storage of instances.
-
-        We don't use the parent class's method here because the checked class
-        has too different a handling of IDs.
-        """
-        kwargs = {'date': self.default_ids[0], 'comment': 'foo'}
-        self.check_saving_and_caching(**kwargs)
-
-    def test_Day_from_table_row(self) -> None:
-        """Test .from_table_row() properly reads in class from DB"""
-        self.check_from_table_row()
-
-    def test_Day_by_id(self) -> None:
-        """Test .by_id()."""
-        self.check_by_id()
-
     def test_Day_by_date_range_filled(self) -> None:
         """Test Day.by_date_range_filled."""
         date1, date2, date3 = self.default_ids
-        day1, day2, day3 = self.check_all()
+        day1 = Day(date1)
+        day2 = Day(date2)
+        day3 = Day(date3)
+        day1.save(self.db_conn)
+        day2.save(self.db_conn)
+        day3.save(self.db_conn)
         # check date range is a closed interval
         self.assertEqual(Day.by_date_range_filled(self.db_conn, date1, date3),
                          [day1, day2, day3])
@@ -86,7 +74,7 @@ class TestsWithDB(TestCaseWithDB):
         self.assertEqual(Day.by_date_range_filled(self.db_conn,
                                                   day5.date, day7.date),
                          [day5, day6, day7])
-        self.check_storage([day1, day2, day3, day6])
+        self.check_identity_with_cache_and_db([day1, day2, day3, day6])
         # check 'today' is interpreted as today's date
         today = Day(date_in_n_days(0))
         today.save(self.db_conn)
@@ -94,14 +82,6 @@ class TestsWithDB(TestCaseWithDB):
                                                   'today', 'today'),
                          [today])
 
-    def test_Day_remove(self) -> None:
-        """Test .remove() effects on DB and cache."""
-        self.check_remove()
-
-    def test_Day_singularity(self) -> None:
-        """Test pointers made for single object keep pointing to it."""
-        self.check_singularity('day_comment', 'boo')
-
 
 class TestsWithServer(TestCaseWithServer):
     """Tests against our HTTP server/handler (and database)."""