40 Commits

Author SHA1 Message Date
Erik Montnemery dfd86d56ec Convert test fixtures to async (#142052) 2025-04-02 14:05:07 +02:00
epenet 7b1b229718 Standardize homeassistant imports in component tests (a-l) (#136806) 2025-01-29 10:00:45 +01:00
Jack Gaino 2910369647 Optionally return response data when calling services through the API (#115046)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-07-31 21:00:04 +02:00
Erik Montnemery 92acfc1464 Indicate database migration in /api/core/state response (#122445)
* Indicate database migration in /api/core/state response

* Change API response according to review comment

* Adjust API response

* Update test

* Add test
2024-07-23 14:13:08 +02:00
Robert Resch bae008b0e2 Remove legacy_api_password auth provider (#119976) 2024-06-19 22:46:30 +02:00
Robert Resch 348e1df949 Add strict connection (#112387)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-12 14:47:46 +02:00
Marc Mueller 32f3f46542 Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
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 0e9e1c8cbe8753159f4fd6775cdc9cf217d66f0e.

* 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