- def test_do_GET_day_basics(self) -> None:
- """Test GET /day basics (no Todos)."""
- # check undefined day
- date = date_in_n_days(0)
- expected = self.GET_day_dict(date)
- self.check_json_get('/day', expected)
- # check "today", "yesterday", "tomorrow" days
- self.check_json_get('/day?date=today', expected)
- expected = self.GET_day_dict(date_in_n_days(1))
- self.check_json_get('/day?date=tomorrow', expected)
- expected = self.GET_day_dict(date_in_n_days(-1))
- self.check_json_get('/day?date=yesterday', expected)
- # check wrong day strings
- self.check_get('/day?date=foo', 400)
- self.check_get('/day?date=2024-02-30', 400)
- # check defined day
- date = '2024-01-01'
- expected = self.GET_day_dict(date)
- assert isinstance(expected['_library'], dict)
- self.check_json_get(f'/day?date={date}', expected)
- # check saved day
- post: dict[str, object] = {'day_comment': 'foo', 'make_type': ''}
- self.post_day(f'date={date}', post)
- expected['_library']['Day'][date]['comment'] = post['day_comment']
- self.check_json_get(f'/day?date={date}', expected)
- # check GET parameter to GET requests affects immediate reply, but …
- expected['make_type'] = 'bar'
- self.check_json_get(f'/day?date={date}&make_type=bar', expected)
- # … not any following, …
- expected['make_type'] = ''
- self.check_json_get(f'/day?date={date}', expected)
- # … not even when part of a POST request
- post['make_type'] = 'foo'
- self.post_day(f'date={date}', post)
- self.check_json_get(f'/day?date={date}', expected)
-