Commit Graph

110 Commits

Author SHA1 Message Date
Whitney Young
8d0dda6523 Remove notify support for templates (#122820) 2024-09-08 17:31:58 +02:00
Marc Mueller
a6068dcdf2 Update import locations in tests (#122216) 2024-07-20 11:16:04 +02:00
Joost Lekkerkerker
0fdf037ba0 Fix ruff type comparison E721 (#120731)
Fix E721
2024-06-28 11:56:49 +02:00
epenet
5e39faa9f8 Improve type hints in auth tests (#120655) 2024-06-28 10:01:53 +01:00
Robert Resch
9f4bf6f11a Create repair when HA auth provider is running in legacy mode (#119975) 2024-06-26 09:00:33 +02:00
Robert Resch
641507a45a Add change username endpoint (#109057) 2024-06-24 18:51:19 +02:00
Robert Resch
bae008b0e2 Remove legacy_api_password auth provider (#119976) 2024-06-19 22:46:30 +02:00
epenet
38a6e666a7 Add missing return type to some test functions (#119665) 2024-06-14 08:26:45 +02:00
Robert Resch
e087abe802 Add ws endpoint to remove expiration date from refresh tokens (#117546)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-05-29 09:09:59 +02:00
epenet
0b4f1cff98 Use issue_registry fixture in core tests (#118042) 2024-05-24 15:26:32 +02:00
J. Nick Koston
a57f4b8f42 Index auth token ids to avoid linear search (#116583)
* Index auth token ids to avoid linear search

* async_remove_refresh_token

* coverage
2024-05-05 16:47:26 -04:00
Joost Lekkerkerker
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
J. Nick Koston
4341b21a61 Migrate auth to use async_import_module to avoid blocking I/O in the event loop (#113387) 2024-03-14 10:44:36 +01:00
J. Nick Koston
4882fed939 Avoid saving auth right after we load it during startup (#112008) 2024-03-09 11:03:22 -10:00
Marc Mueller
a6b842f818 Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Michael
f5d439799b Add expiration of unused refresh tokens (#108428)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-01-24 13:24:22 -10: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
ec15b0def2 Always load auth storage at startup (#108543) 2024-01-20 16:16:43 -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
Jan-Philipp Benecke
6666b796f2 Migrate auth tests to use freezegun (#105243) 2023-12-07 21:18:10 +01:00
Robert Resch
cf9b0e804f Deprecate legacy api auth provider (#104409)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:16:18 +01:00
Hejki
65a2f5bcd5 Support for group into command_line auth provider (#92906)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 13:19:25 +01:00
J. Nick Koston
2dfc8b9d7f Avoid conversion of timestamps in jwt auth (#101856) 2023-10-13 14:11:17 +02:00
J. Nick Koston
5c6ed8f6d5 Use call_at for events instead call_later (#93431)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-05-24 21:04:07 +02:00
Patrick Li
46103f56c4 Fix trusted_users group schema (#92847)
* Fix trusted_users group schema

* Add tests for CONFIG_SCHEMA
2023-05-23 20:11:25 +02:00
J. Nick Koston
ca576d45ac Cache decode of JWT tokens (#90013) 2023-03-22 16:03:41 -10:00
epenet
a51cc75f03 Add type hints to core tests (part 2) (#88492) 2023-02-21 09:27:13 +01:00
epenet
5f25b71df7 Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
epenet
c98b4e3204 Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
epenet
59ca7780fa Add typing to tests with single hass argument (#87631) 2023-02-07 15:01:16 +01:00
epenet
4142f0d15d Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
epenet
aa00114c2f Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Franck Nijhof
57cf11f067 Enable Ruff PT015 (#86775) 2023-01-27 11:10:29 +01:00
Joakim Plate
c576a68d33 Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
Franck Nijhof
a6244eea28 Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
Franck Nijhof
7cd68381f1 Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
J. Nick Koston
211e5432ac Add EVENT_USER_UPDATED (#71965) 2022-06-09 20:49:02 -07:00
Franck Nijhof
69cc6ab5f1 Clean up accessing entity_registry.async_get_registry helper via hass (#72005) 2022-05-17 16:40:45 +02:00
Paulus Schoutsen
914f7f85ec Add local only users (#57598) 2021-11-29 14:01:03 -08:00
Paulus Schoutsen
e30e4d5c6d Block cloud explicitely from trusted networks (#59333)
* Block cloud explicitely from trusted networks

* Lint
2021-11-12 10:25:01 +01:00
Paulus Schoutsen
ffbe4cffae Guard linking credential that is already linked (#57595)
* Guard linking credential that is already linked

* Update test descriptions
2021-10-13 17:36:31 +02:00
Paulus Schoutsen
0ae1186554 Use gather ipv wait to remove credentials to catch exceptions (#57596) 2021-10-13 17:34:57 +02:00
David Boslee
7f966613bd Disconnect websockets after token is revoked (#57091)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-10-08 09:38:22 -07:00
Ruslan Sayfutdinov
7195b8222b Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Ville Skyttä
9864f2ef8b String formatting cleanups (#52937) 2021-07-13 00:12:55 +02:00
Joakim Plate
d339e3bd8c Reject trusted network access from proxies (#52388) 2021-07-02 11:49:42 +02:00
Joakim Sørensen
c8755cd896 Migrate the name for the hassio user (#51771) 2021-06-14 09:01:18 -07:00
Franck Nijhof
cdd1f6b2f0 Always load middle to handle forwarded proxy data (#51332) 2021-06-01 09:38:55 -07:00
Paulus Schoutsen
bd0373388d Trusted networks auth provider warns if detects a requests with x-forwarded-for header while the http integration is not configured for reverse proxies (#51319)
* Trusted networks auth provider to require http integration configured for proxies to allow logging in with requests with x-forwarded-for header

* Make it a warning
2021-06-01 12:51:44 +02:00