Increase test coverage for google calendar (#62648)

* Increase test coverage for google calendar

Update tests to exercise the API responses, getting test coverage
to 97% for calendar.py

----------- coverage: platform linux, python 3.9.6-final-0 -----------
Name                                          Stmts   Miss  Cover   Missing
---------------------------------------------------------------------------
homeassistant/components/google/__init__.py     193     84    56%   92, 163-228, 238, 244-247, 254-262, 274, 298-299, 305-347, 387-392, 416-430, 435-437
homeassistant/components/google/calendar.py     122      4    97%   41, 45, 51, 135
---------------------------------------------------------------------------
TOTAL                                           315     88    72%

* Revert conftest changes

* Update typing errors found on CI

* Update python3.8 typing imports

* Remove commented out code
This commit is contained in:
Allen Porter 2021-12-22 22:31:56 -08:00 committed by GitHub
parent 6ef7539a31
commit 23277181ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 170 additions and 9 deletions

View file

@ -121,8 +121,8 @@ class GoogleCalendarData:
def _prepare_query(self):
try:
service = self.calendar_service.get()
except ServerNotFoundError:
_LOGGER.error("Unable to connect to Google")
except ServerNotFoundError as err:
_LOGGER.error("Unable to connect to Google: %s", err)
return None, None
params = dict(DEFAULT_GOOGLE_SEARCH_PARAMS)
params["calendarId"] = self.calendar_id