home · contact · privacy
Remove some redundant code.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 20 Mar 2024 02:52:49 +0000 (03:52 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 20 Mar 2024 02:52:49 +0000 (03:52 +0100)
plomtask/http.py
tests/test_days.py

index 58b575f837774e5f6106b61b32ec452ff395c2b0..e812471a9c8eb5bd0d0dccb6df1f5546ee16a20d 100644 (file)
@@ -72,9 +72,8 @@ class TaskHandler(BaseHTTPRequestHandler):
 
     def do_POST_day(self, conn: DatabaseConnection, date: str, postvars: dict):
         """Update or insert Day of date and fields defined in postvars."""
-        comment = postvars['comment'][0]
         day = Day.by_date(conn, date, create=True)
-        day.comment = comment
+        day.comment = postvars['comment'][0]
         day.save(conn)
 
     def _init_handling(self):
index ba91c057a1d38bbe1aaef197e2adeb320fcc2f94..f35e6b2725cdc3545f4490d7d8fe94f940704004 100644 (file)
@@ -93,18 +93,6 @@ class TestsWithDB(TestCase):
         today.save(self.db_conn)
         self.assertEqual(Day.all(self.db_conn, ('today', 'today')), [today])
 
-    def test_Day_comment(self):
-        """Test Day.comment."""
-        self.assertEqual(None, Day.by_date(self.db_conn, '2024-01-01'))
-        d1 = Day('2024-01-01')
-        d1.save(self.db_conn)
-        day_retrieved = Day.by_date(self.db_conn, d1.date)
-        self.assertEqual(day_retrieved.comment, '')
-        d2 = Day('2024-01-02', 'foo')
-        d2.save(self.db_conn)
-        day_retrieved = Day.by_date(self.db_conn, d2.date)
-        self.assertEqual(day_retrieved.comment, 'foo')
-
     def test_Day_neighbor_dates(self):
         """Test Day.prev_date and Day.next_date."""
         self.assertEqual(Day('2024-01-01').prev_date, '2023-12-31')