Commit Graph

14 Commits (473647091541b4f3786ddc3d1168ecf9ae720cc7)

Author SHA1 Message Date
Erik Montnemery cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
Allen Porter 7876ffe9e3
Update google calendar integration with a config flow (#68010)
* Convert google calendar to config flow and async

* Call correct exchange method

* Fix async method and reduce unnecessary diffs

* Wording improvements

* Reduce unnecessary diffs

* Run load/update config from executor

* Update homeassistant/components/google/calendar.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove unnecessary updating of unexpected multiple config entries.

* Remove unnecessary unique_id checks

* Improve readability with comments about device code expiration

* Update homeassistant/components/google/calendar.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/google/calendar.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/google/api.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Add comment for when code is none on timeout

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-15 07:51:02 +01:00
Allen Porter 8adcd10f55
Make google calendar loading API centric, not loading from yaml (#67722)
* Make google calendar loading API centric, not loading from yaml

Update the behavior for google calendar to focus on loading calendars based on the
API and using the yaml configuration to override behavior. The old behavior was
to first load from yaml, then also load from the API, which is atypical.

This is pulled out from a larger change to rewrite calendar using async and config
flows.

Tests needed to be updated to reflect the new API centric behavior, and changing
the API call ordering required changing tests that exercise failures.

* Update to use async_fire_time_changed to invoke updates
2022-03-08 21:56:49 +01:00
Allen Porter 57ffc65af2
Improve google calendar test quality and share setup (#67441)
* Improve google calendar test quality and share setup

Improve google calendar test quality by exercising different combinations of
cases and new coverage. The existing test cases do achieve very high coverage,
however some of the subtle interactions between the components are not as well
exercised, which is needed when we start changing how the internal code is
structured moving to async or to config entries.

Ipmrovement include:
- Exercising additional cases around different types of configuration parameters
  that control how calendars are tracked or not tracked. The tracking can be
  configured in google_calendars.yaml, or by defaults set in configuration.yaml
  for new calendars.
- Share even more test setup, used when exercising the above different scenarios
- Add new test cases for event creation.
- Improve test readability by making more clear the differences between tests
  exercising yaml and API test calendars. The data types are now more clearly
  separated in the two cases, as well as the entity names created in the two
  cases.

* Undo some diffs for readability

* Improve pydoc readability

* Improve pydoc readability

* Incorporate improvements from Martin

* Make test parameters a State instance

* Update test naming to be more correct

* Fix flake8 errors
2022-03-03 23:12:24 -08:00
Allen Porter 4e52f26ed1
Fix flaky google calendar test (#67600) 2022-03-03 22:48:55 -08:00
Allen Porter deda9e38e4
Simplify google calendar API interactions (#67319)
* Simplify google calendar APIs and tests

* Simplify authentication logic at startup

* Improve readability of diffs

* Reduce diffs

* Simplify api datetime logic

* Remove duplicate test fixtures added in prior commit

* Remove duplicate event filter calls

* Fix event list argument names

* More improvements found from additional testing

* Remove unnecessary variables in create event call
2022-02-26 16:19:45 -08:00
Allen Porter 0e74184e4f
Simplify google calendar authentication setup (#67314)
Simplify google calendar authentication to combine some of the cases together, and reduce unecessarily checks. Make the
tests share common authentication setup and reduce use of mocks by introducing a fake for holding on to credentials.
This makes future refactoring simpler, so we don't have to care as much about the interactions with the credentials
storage.
2022-02-26 15:17:02 -08:00
Allen Porter 88ed2f3b3e
Improve google calendar test coverage to 97% (#65223)
* Improve google calendar test coverage to 97%

* Remove commented out code.

* Remove unnecessary (flaky) checks for token file persistence

* Remove mock code assertions

* Add debug logging to google calendar integration

* Increase alarm time to polling code to reduce flakes

* Setup every test in their own configuration directory

* Mock out filesystem calls to avoid disk dependencies

Update scope checking code to use Storage object rather than text file matching

* Update tests to check entity states when integration is loaded

* Mock out google service in multiple locations

* Update homeassistant/components/google/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/google/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-01 03:14:49 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Quentame 1855c91988
Use CONF_CLIENT_ID & CONF_CLIENT_SECRET from homeassistant.const (#36233)
* Use CONF_CLIENT_ID & CONF_CLIENT_SECRET from homeassistant.const

* Fix pylint

* Use in tests

* Search for "client_id"

* Fix tests

* Fix test

* Fix test
2020-05-30 17:27:20 +02:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Martin Hjelmare b9fda078a4
Clean and fix google calendar tests (#23608)
* Clean and fix google calendar tests

* Extract test calendar constant for google test
* Rewrite google calendar tests
* Clean and fix google calendar tests
* Clean and fix google component tests
* Add google conftest
* Skip flaky google calendar test

* Fix google calendar bug

* Fix yield fixture

* Set fixture names to avoid lint warning

* Fix yield fixture
2019-05-05 18:38:55 +02:00
Paulus Schoutsen b8cc547fa3
Move components to folders (#20774)
* Move all components into folders

* Move component tests into folders

* Fix init moving

* Move tests

* Lint

* Update coverage

* Fix service descriptions

* Update CODEOWNERS
2019-02-05 19:31:15 -08:00