Skip to content

Commit

Permalink
adding warning for workaround in events api #106
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteUEM committed Oct 7, 2024
1 parent 0902ab4 commit 7569933
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions churchtools_api/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def get_events(self, **kwargs) -> list[dict]:
if 'include' in kwargs.keys():
params['include'] = kwargs['include']

if from_ == to_ :
logger.warning("As of 29. Sept 2024 there is a known bug which will not return results for same day searches! - reported to CT team as issue 130629")

response = self.session.get(url=url, headers=headers, params=params)

if response.status_code == 200:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_churchtools_api_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ def test_get_events(self):

# TODO add test cases for uncommon parts #24 * canceled, include

def test_get_events_sameday(self):
"""Special test case checking confirmity of event search for same day.
See https://github.com/bensteUEM/ChurchToolsAPI/issues/109.
IMPORTANT - This test method and the parameters used depend on the target system!
the hard coded sample exists on ELKW1610.KRZ.TOOLS
"""
SAMPLE_DAY = datetime(year=2024,month=9,day=29)
events = self.api.get_events(from_= SAMPLE_DAY, to_=SAMPLE_DAY)

logger.warning("As of 29. Sept 2024 there is a known bug which will not return results for same day searches! - reported to CT team as issue 130629")
assert len(events) > 0

retrieved_dates = {datetime.strptime(event["startDate"][:10],"%Y-%m-%d") for event in events}
assert {SAMPLE_DAY} == retrieved_dates


def test_get_AllEventData_ajax(self):
"""
IMPORTANT - This test method and the parameters used depend on the target system!
Expand Down

0 comments on commit 7569933

Please sign in to comment.