Commit Graph

78 Commits (b07e9df308a2fec26d76ee0ae046c5699d0546d1)

Author SHA1 Message Date
karwosts f456e3a071
Allow delete_all_refresh_tokens to delete a specific token_type (#106119)
* Allow delete_all_refresh_tokens to delete a specific token_type

* add a test

* minor string change

* test updates

* more test updates

* more test updates

* fix tests

* do not delete current token

* Update tests/components/auth/test_init.py

* Update tests/components/auth/test_init.py

* Option to not delete the current token

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-01-29 17:09:23 +01:00
J. Nick Koston 2eea658fd8
Convert getting and removing access tokens to normal functions (#108670) 2024-01-22 20:51:33 -10:00
Robert Resch 1c669c6e84
Revert "Revert "Add preselect_remember_me to `/auth/providers`"" (#106867) 2024-01-11 10:37:19 +01:00
Franck Nijhof 0f3e6b0dec
Revert "Add preselect_remember_me to `/auth/providers`" (#106472)
Revert "Add preselect_remember_me to `/auth/providers` (#106462)"

This reverts commit c19688e2d2.
2023-12-27 13:22:12 +01:00
Robert Resch c19688e2d2
Add preselect_remember_me to `/auth/providers` (#106462) 2023-12-27 11:47:52 +01:00
Franck Nijhof cc75430af3
Disable user profiles on login screen (#105749) 2023-12-14 20:28:08 +01:00
Jan-Philipp Benecke 6666b796f2
Migrate auth tests to use freezegun (#105243) 2023-12-07 21:18:10 +01:00
Robert Resch 852fb58ca8
Extend `auth/providers` endpoint and add `/api/person/list` endpoint for local ip requests (#103906)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-11-24 17:11:54 +01:00
Robert Resch 6223b1f599
Add ws endpoint "auth/delete_all_refresh_tokens" (#98976)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-08-29 15:57:54 +02:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet 07a1a0efa9
Add type hints to integration tests (part 1) (#87777) 2023-02-09 16:09:13 +01:00
epenet 2545694d41
Add type hints to integration tests (a) (#87684)
* Add type hints to accuweather tests

* Adjust a** components

* Adjust aiohttp_client

* ClientSessionGenerator/WebSocketGenerator
2023-02-08 12:16:23 +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 3b5fd4bd06
Enable Ruff TRY004 (#86811) 2023-01-30 14:06:52 +01:00
Joris Pelgröm 8aeb20db00
Update allowlisted OAuth redirect URIs for Wear OS in China (#86247) 2023-01-19 16:07:08 -05: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
Joris Pelgröm fa0dfd812c
Update allowlisted OAuth redirect URIs for Wear OS (#77411) 2022-08-29 21:52:10 -04:00
Paulus Schoutsen 14f68ec1a9
Store redirect URI in context instead of asking each time (#77380)
* Store redirect URI in context instead of asking each time

* Fix tests
2022-08-29 19:28:42 -04:00
Paulus Schoutsen 59878ea1ef
Indieauth updates (#76880) 2022-08-16 17:17:10 -04:00
Marc Mueller 563ec67d39
Add strict typing for auth (#75586) 2022-08-16 10:10:37 -04:00
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
Paulus Schoutsen a733b92389
Include provider type in auth token response (#72560) 2022-05-27 10:31:48 -07:00
Paulus Schoutsen ff3374b4e0
Use modern WS API for auth integration + add auth provider type to refresh token info (#72552) 2022-05-26 13:06:34 -07:00
Paulus Schoutsen 63f8e437ed
Add Home Assistant Content user (#64337) 2022-01-21 10:06:39 -08:00
Paulus Schoutsen 72d8882c79
Handle errors response to be None (#60679)
Co-authored-by: Philip Allgaier <mail@spacegaier.de>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-12-01 13:51:10 +01:00
Paulus Schoutsen 914f7f85ec
Add local only users (#57598) 2021-11-29 14:01:03 -08:00
Paulus Schoutsen c6ec84d0cf
Remove store user as auth result (#60468) 2021-11-28 14:14:52 +01:00
J. Nick Koston 3b7dce8b95
Index in-progress flows to avoid linear search (#58146)
Co-authored-by: Steven Looman <steven.looman@gmail.com>
2021-10-22 07:19:49 -10: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
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
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
Erik Montnemery f6682ba99d
Block tests from opening sockets (#55516) 2021-10-05 14:46:09 -10:00
Paulus Schoutsen 2d374d65b6
Mark auth voluptuous schema fields as required (#57003) 2021-10-03 22:02:30 -07:00
Joakim Plate 38d2cacf7a
Support blocking trusted network from new ip (#44630)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-28 12:06:20 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Paulus Schoutsen ba120d4220
Fix client ID lookup for official apps (#36131) 2020-05-25 15:39:24 -04: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 ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07: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
springstan b41cbe9885
Add www. to all documentation links (#32063)
* Add www. to all documentation links

* Fix broken redirect uri test
2020-02-21 16:10:02 -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
Paulus Schoutsen 5a9e543087
Whitelist Android/iOS auth callbacks (#30082)
* Whitelist Android/iOS

* Add iOS alternate flavor URLs

* Update indieauth.py

Co-authored-by: Robbie Trencheny <me@robbiet.us>
2019-12-28 21:20:18 +01:00
Bas Nijholt 6ad3b6426a sort imports according to PEP8 for auth (#29619) 2019-12-08 14:55:23 +01:00
Paulus Schoutsen 3231e22ddf
Remove direct authentication via trusted networks or API password (#27656)
* Remove direct authentication via trusted networks and API password

* Fix tests
2019-10-14 14:56:45 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen f4016b4aad
Add integration step to onboarding (#23732)
* Return an extra oauth2 auth code during onboarding

* Areas in const

* Add integration step

* Lint

* Fix tests

* Fix test

* Verify integration added to done

* Verify step is marked as done
2019-05-07 22:51:24 -07:00
Paulus Schoutsen d1a621601d No more opt-out auth (#18854)
* No more opt-out auth

* Fix var
2018-12-02 16:32:53 +01:00
Paulus Schoutsen 312d49caec Allow creating signed urls (#17759)
* Allow creating signed urls

* Fix parameter

* Lint
2018-10-25 16:44:57 +02:00