From a1d3ef4b42bdac28f20d7f104ff93bf7efa37a30 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 2 May 2024 03:46:48 +0200
Subject: [PATCH] Minor tests refactoring.

---
 tests/conditions.py | 2 +-
 tests/days.py       | 4 ++--
 tests/utils.py      | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/conditions.py b/tests/conditions.py
index f825ba4..dabcf06 100644
--- a/tests/conditions.py
+++ b/tests/conditions.py
@@ -47,7 +47,7 @@ class TestsWithDB(TestCaseWithDB):
 
     def test_Condition_from_table_row(self) -> None:
         """Test .from_table_row() properly reads in class from DB"""
-        self.check_from_table_row(1)
+        self.check_from_table_row()
         c = self.versioned_condition()
         c.save(self.db_conn)
         assert isinstance(c.id_, int)
diff --git a/tests/days.py b/tests/days.py
index c143f98..1f0e55d 100644
--- a/tests/days.py
+++ b/tests/days.py
@@ -44,12 +44,12 @@ class TestsWithDB(TestCaseWithDB):
 
     def test_Day_saving_and_caching(self) -> None:
         """Test .save/.save_core."""
-        kwargs = {'date': '2024-01-01', 'comment': 'foo'}
+        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('2024-01-01')
+        self.check_from_table_row()
 
     def test_Day_by_id(self) -> None:
         """Test .by_id()."""
diff --git a/tests/utils.py b/tests/utils.py
index a826c16..61dbb36 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -79,8 +79,9 @@ class TestCaseWithDB(TestCase):
         self.assertEqual(self.checked_class(id2), by_id_created)
         self.check_storage([obj])
 
-    def check_from_table_row(self, id_: int | str) -> None:
+    def check_from_table_row(self) -> None:
         """Test .from_table_row() properly reads in class from DB"""
+        id_ = self.default_ids[0]
         obj = self.checked_class(id_)  # pylint: disable=not-callable
         obj.save(self.db_conn)
         assert isinstance(obj.id_, (str, int))
-- 
2.30.2