118 Commits

Author SHA1 Message Date
Erik Montnemery
428cc1a951
Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
epenet
7b1b229718
Standardize homeassistant imports in component tests (a-l) (#136806) 2025-01-29 10:00:45 +01:00
epenet
b43379be7d
Standardize helpers.xxx_registry imports (#136688)
Standardize registry imports
2025-01-28 08:48:34 +01:00
epenet
1ec91e7c89
Remove deprecated supported features warning in Lock (#132642) 2024-12-09 08:45:36 +01:00
Robert Resch
1d09a5bf89
Remove deprecated lock constants (#131812) 2024-11-28 12:21:13 +01:00
G Johansson
93aade6e8e
Change lock state to an enum (#126379)
* Add new LockState enum for lock states

* Add rest

* Fix insteon tests

* Fix mqtt tests

* Fix tesla_fleet

* Revert back ST_STATE_LOCKED

* Add back constant
2024-09-24 12:30:50 +02:00
epenet
07f095aa42
Use service_calls fixture in core platform tests [a-l] (#120904) 2024-07-01 19:27:50 +02:00
Marc Mueller
921430d497
Import Generator from collections.abc (3) (#120916) 2024-07-01 12:09:11 +02:00
epenet
dc6c1f4e87
Add MockPlatform type hints in tests (#120012)
* Add MockPlatform type hints in tests

* Remove useless code

* Improve

* Revert "Improve"

This reverts commit 9ad04f925514af46a7cd64f94a518fc093da825c.
2024-06-21 11:04:15 +02:00
epenet
abb8c58b87
Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
Marc Mueller
33ed4fd862
Import Generator from typing_extensions (3) (#118990) 2024-06-06 17:28:59 +02:00
J. Nick Koston
ed0568c655
Ensure config entries are not unloaded while their platforms are setting up (#118767)
* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* run with error on to find them

* cert_exp, hold lock

* cert_exp, hold lock

* shelly async_late_forward_entry_setups

* compact

* compact

* found another

* patch up mobileapp

* patch up hue tests

* patch up smartthings

* fix mqtt

* fix esphome

* zwave_js

* mqtt

* rework

* fixes

* fix mocking

* fix mocking

* do not call async_forward_entry_setup directly

* docstrings

* docstrings

* docstrings

* add comments

* doc strings

* fixed all in core, turn off strict

* coverage

* coverage

* missing

* coverage
2024-06-04 21:34:39 -04:00
epenet
7e62061b9a
Improve typing for calls fixture in tests (a-l) (#118349)
* Improve typing for `calls` fixture in tests (a-l)

* More

* More
2024-05-29 09:06:48 +02:00
G Johansson
7862596ef3
Add open state to LockEntity (#111968)
* Add `open` state to LockEntity

* Add tests

* Fixes

* Fix tests

* strings and icons

* Adjust demo open lock

* Fix lock and tests

* fix import

* Fix strings

* mute ruff

* Change sequence

* Sequence2

* Group on states

* Fix ruff

* Fix tests

* Add more test cases

* Sorting
2024-05-08 20:42:22 +02:00
Sid
9bf87329da
Enable Ruff FLY002 rule (#115112)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-12 09:04:16 +02:00
Sid
d5f883fbf0
Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Sid
00ec7f11f0
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Marc Mueller
32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller
1722e23df8
Add empty line after module docstring [tests l-p] (#112710) 2024-03-08 14:55:15 +01:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
J. Nick Koston
2b972f6dba
Add deprecation warning for lock supported features when using magic numbers (#106620) 2023-12-28 15:03:14 -10:00
G Johansson
8cd0644035
Add translation to ServiceValidationError in Lock (#105746) 2023-12-27 12:50:27 +01:00
Robert Resch
491a50a2f1
Deprecate deprecated lock constants (#106113) 2023-12-20 18:07:17 +01:00
Jan Bouwhuis
280637822b
Use mocked entity platform for lock service tests (#105020)
* Use mocked entity platform for lock service tests

* Cleanup old mock class

* Follow up on code review

* Improve mock entity platform

* Use entity_id of passed entity instead of constant
2023-12-12 15:49:01 +01:00
Jan Bouwhuis
7d21ed41a2
Refactor lock default code handling (#104807) 2023-12-04 14:59:51 +01:00
Øyvind Matheson Wergeland
5527cbd78a
Fix default lock code for lock services (#103463)
* verisure: Support default code from lock entity

* Actually use default lock code

* Typing

* Only pass default code if set

* Avoid passing code as empty string

* Simplified code
2023-11-20 22:38:16 +01:00
Jan-Philipp Benecke
0eafc8f2cd
Update k-l* tests to use entity & device registry fixtures (#103929) 2023-11-13 20:02:33 +01:00
Erik Montnemery
b38692f3a7
Use real devices in lock device condition tests (#102757) 2023-10-25 09:42:00 +02:00
Erik Montnemery
f56343f447
Use real devices in lock device action tests (#102723) 2023-10-24 23:43:50 +02:00
Erik Montnemery
f9fa1edabf
Use real devices in lock device trigger tests (#102690) 2023-10-24 22:30:07 +02:00
Ville Skyttä
e7b6037419
Remove unnnecessary pylint configs from components [e-l]* (#99004) 2023-08-25 09:46:34 +02:00
Erik Montnemery
320003bf15
Use entity registry id in lock device actions (#95272) 2023-06-26 23:09:26 +02:00
Erik Montnemery
2cfa889750
Use entity registry id in lock device conditions (#95257) 2023-06-26 20:30:05 +02:00
Erik Montnemery
e404441e8c
Teach lock device trigger about entity registry ids (#94975) 2023-06-21 14:51:09 +02:00
Erik Montnemery
fd822bce56
Replace assert_lists_same with pytest_unordered in integrations h-m (#94901) 2023-06-20 20:16:25 +02:00
Jan Bouwhuis
ec98e22330
Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik Montnemery
3cca338c6e
Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
G Johansson
0bda869553
Lock entity options (#88139) 2023-05-08 22:06:11 +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
ea11a30a35
Add type hints to integration tests (part 13) (#87998) 2023-02-13 14:38:37 +01:00
Erik Montnemery
cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Franck Nijhof
51a9f65a01
Clean up unnecessary registry mocks from Core tests (#87726) 2023-02-08 13:28:44 -06:00
epenet
f75ac17554
Add type hints to integration tests (j-m) (#87704) 2023-02-08 19:06:59 +01:00
epenet
aa00114c2f
Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Jan Bouwhuis
b03677db1c
Add validation for lock component (#85842)
* Add validation for lock integration

* Add LockEntityFeature.OPEN for lock group

* Correct tests google_assistant for extra entity

* Validate feature when registering service

* Update tests

* Add LockFeature.OPEN with group
2023-01-23 13:08:00 +01:00
Erik Montnemery
5e50a8abd5
Mark device triggers from hidden or auxiliary entities as secondary (#70335)
* Mark device triggers from hidden or auxiliary entities as secondary

* Update tests
2022-04-21 08:01:32 +02:00
Erik Montnemery
150f173eed
Mark device conditions from hidden or auxiliary entities as secondary (#70333) 2022-04-20 21:41:59 +02:00
Erik Montnemery
64381acbaf
Mark device actions from hidden or auxiliary entities as secondary (#70278) 2022-04-20 10:48:46 -07:00
Franck Nijhof
721db6d962
Add EntityFeature enum to Lock (#69118) 2022-04-02 20:57:32 -07:00
Franck Nijhof
8aff8d89d2
Clean up async_reproduce_state helper usage (#68617) 2022-03-24 14:40:54 +01:00