+
+ def test_GET_calendar(self) -> None:
+ """Test GET /calendar responses based on various inputs, DB states."""
+ # check illegal date range delimiters
+ self.check_get('/calendar?start=foo', 400)
+ self.check_get('/calendar?end=foo', 400)
+ # check default range without saved days
+ expected = self.GET_calendar_dict(-1, 366)
+ self.check_json_get('/calendar', expected)
+ self.check_json_get('/calendar?start=&end=', expected)
+ # check named days as delimiters
+ expected = self.GET_calendar_dict(-1, +1)
+ self.check_json_get('/calendar?start=yesterday&end=tomorrow', expected)
+ # check zero-element range
+ expected = self.GET_calendar_dict(+1, 0)
+ self.check_json_get('/calendar?start=tomorrow&end=today', expected)
+ # check saved day shows up in results with proven by its comment
+ post_day: dict[str, object] = {'day_comment': 'foo', 'make_type': ''}
+ date1 = date_in_n_days(-2)
+ self._post_day(f'date={date1}', post_day)
+ start_date = date_in_n_days(-5)
+ end_date = date_in_n_days(+5)
+ url = f'/calendar?start={start_date}&end={end_date}'
+ expected = self.GET_calendar_dict(-5, +5)
+ assert isinstance(expected['_library'], dict)
+ expected['_library']['Day'][date1]['comment'] = post_day['day_comment']
+ self.check_json_get(url, expected)