Commit Graph

33 Commits (b07e9df308a2fec26d76ee0ae046c5699d0546d1)

Author SHA1 Message Date
J. Nick Koston 2eea658fd8
Convert getting and removing access tokens to normal functions (#108670) 2024-01-22 20:51:33 -10:00
J. Nick Koston 52b5d2e370
Avoid json encoder default fallback when serializing config (#108360)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-01-19 19:22:17 -10:00
J. Nick Koston b1d0c6a4f1
Refactor User attribute caching to be safer and more efficient (#96723)
* Cache construction of is_admin

This has to be checked for a lot of api calls and the websocket
every time the call is made

* Cache construction of is_admin

This has to be checked for a lot of api calls and the websocket
every time the call is made

* Cache construction of is_admin

This has to be checked for a lot of api calls and the websocket
every time the call is made

* modernize

* coverage

* coverage

* verify caching

* verify caching

* fix type

* fix mocking
2024-01-13 15:10:50 -05:00
Martin Hjelmare e884933dbd
Remove rest api service call timeout (#104709) 2023-11-29 14:46:19 +01:00
Denis Shulyaka d18b2d8748
Shield service call from cancellation on REST API connection loss (#102657)
* Shield service call from cancellation on connection loss

* add test for timeout

* Apply suggestions from code review

* Apply suggestions from code review

* fix merge

* Apply suggestions from code review
2023-11-02 12:58:26 +01:00
Erik Montnemery 368acaf6fd
Improve error handling in /api/states POST (#99810) 2023-09-07 13:33:38 +02:00
J. Nick Koston d2a52230ff
Speed up responding to states being polled via API (#99621)
* Speed up responding to states being polled via API

Switch to using `as_dict_json` to avoid serializing states over and over when the
states api is polled since the mobile app is already building the cache as it also
polls the states via the websocket_api

* Speed up responding to states being polled via API

Switch to using `as_dict_json` to avoid serializing states over and over when the
states api is polled since the mobile app is already building the cache as it also
polls the states via the websocket_api

* fix json

* cover
2023-09-04 16:51:19 -04:00
J. Nick Koston acd9cfa929
Speed up calls to the all states api (#99462) 2023-09-02 12:08:07 -05:00
Ville Skyttä 3b4774d9ed
Remove unnnecessary pylint configs from components/[a-d]* (#98911) 2023-08-24 00:54:02 +02:00
J. Nick Koston 29aa89bea0
Add lightweight API to get core state (#96860) 2023-07-19 20:31:48 +02:00
J. Nick Koston 48b93e03ee
Cache transient templates compiles provided via api (#89065)
* Cache transient templates compiles provided via api

partially fixes #89047 (there is more going on here)

* add a bit more coverage just to be sure

* switch method

* Revert "switch method"

This reverts commit 0e9e1c8cbe.

* tweak

* hold hass

* empty for github flakey
2023-03-02 21:31:12 -05:00
epenet 07a1a0efa9
Add type hints to integration tests (part 1) (#87777) 2023-02-09 16:09:13 +01:00
J. Nick Koston c612a92cfb
Use python defaults for comparing State, LazyState, and Event objects (#86856)
* Speed up comparing State and Event objects

Use default python implementation for State and Event __hash__ and __eq__

The default implementation compared based on the id() of the object
which is effectively what we want here anyways. These overrides are
left over from the days when these used to be attrs objects

By avoiding implementing these ourselves all of the equality checks
can happen in native code

* tweak

* adjust tests

* write out some more

* fix test to not compare objects

* more test fixes

* more test fixes

* correct stats tests

* fix more tests

* fix more tests

* update sensor recorder tests
2023-01-29 13:31:43 -05:00
epenet 30bf0634fe
Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
uvjustin 31ad208500
Use async with to fetch HTTP streams in tests (#82788) 2022-11-27 14:35:03 -05:00
Joakim Sørensen 04c5e51cbd
Remove the deprecated discovery_info endpoint (#64534) 2022-01-20 13:46:48 +01:00
Ville Skyttä a598d9f353
Use HTTPStatus instead of HTTP_ consts and magic values in components/a* (#57988) 2021-10-22 14:21:34 +02:00
Ville Skyttä 1aa7c87151
Remove redundant aiohttp response status=200 kwargs (#56417)
* Remove redundant aiohttp response status=200 kwargs

* Remove some more in h.c.auth

* Restore explicit status=HTTP_OK for auth and webhook per review request
2021-09-21 10:51:12 -07:00
Joakim Sørensen bcb3c426f4
Blank out discovery info (#56097) 2021-09-11 12:34:19 -07:00
Erik Montnemery d5b6dc4f26
Use hass_client_no_auth test fixture in integrations a-g (#55581) 2021-09-02 14:49:20 +02:00
Paulus Schoutsen ff94e920e4
Do not use AsyncTrackStates (#47255) 2021-03-11 23:18:09 -08:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Paulus Schoutsen 8ed1a29c82
Drop white blacklist pt1 (#37816) 2020-07-13 17:43:11 +02:00
Aaron Bach 7968cd650a
Add concept of allowed external URLs to config (#36988)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-06-24 17:37:01 -07: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
springstan 9a40d5b7ed
Use HTTP_NOT_FOUND constant (#33835) 2020-04-09 00:57:47 +02:00
springstan 524a1a7587
Use f-strings in integrations starting with "A" (#32110)
* Use f-strings in integrations starting with A

* Use f-strings in tests for integrations starting with A

* Fix pylint by renaming variable

* Fix nested for loop in f-string for aprs device_tracker

* Break long lines into multiple short lines

* Break long lines into multiple short lines v2
2020-02-23 13:38:05 -08:00
Christian Clauss df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Ville Skyttä 5216477353
Be consistent with Home Assistant and Hass.io spelling (#30500)
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02:00
Franck Nijhof 0280862780 Migrate api tests from coroutine to async/await (#30338) 2019-12-31 22:58:40 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Jason Hu fe1840f901 Deprecate http.api_password (#21884)
* Deprecated http.api_password

* Deprecated ApiConfig.api_password

GitHub Drafted PR would trigger CI after changed it to normal PR.
I have to commit a comment change to trigger it

* Trigger CI

* Adjust if- elif chain in auth middleware
2019-03-10 19:55:36 -07: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