Commit graph

193 commits

Author SHA1 Message Date
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
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
Franck Nijhof
5e81d28116
Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Franck Nijhof
57cf11f067
Enable Ruff PT015 (#86775) 2023-01-27 11:10:29 +01:00
Franck Nijhof
fca3382d37
Migrates tests to use MediaPlayerEntityFeature enum (#86779) 2023-01-27 10:56:40 +01:00
Jan Bouwhuis
f182e314e5
Add number platform support to Alexa (#86553)
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
2023-01-25 13:34:53 +01:00
epenet
30bf0634fe
Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
Franck Nijhof
24fdd588fd
Code styling tweaks to the tests - Part 1 (#86192) 2023-01-20 13:52:46 +01:00
Franck Nijhof
91aaca6471
Code styling tweaks to the Alexa integration (#86121) 2023-01-18 01:01:30 +02:00
Michael
2850583085
Replace the usage of unit constants by enumerations in Tests [a-e] (#85932) 2023-01-15 14:44:01 +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
Jan Bouwhuis
5d4c4a1293
Add humidifier support for Alexa (#81329) 2022-11-28 09:55:22 -10:00
epenet
e84e5f134e
Use US_CUSTOMARY_SYSTEM in tests (#80658)
* Use US_CUSTOMARY_SYSTEM in tests

* Don't update test_unit_system
2022-10-20 15:42:23 +02:00
epenet
0d696b84b2
Cleanup root component imports in tests (#78893) 2022-09-21 06:57:41 -10:00
epenet
fe747601ff
Cleanup DeviceClass and StateClass in tests (#78811) 2022-09-20 10:49:11 -04:00
epenet
52a377ca9d
Adjust root-import in alexa tests (#78766) 2022-09-19 15:38:33 +02:00
Erik Montnemery
d034ed1fc2
Remove some error prone code from Alexa tests (#76917) 2022-08-17 07:54:54 -04:00
Jan Bouwhuis
e6e5b98bc7
Allow climate operation mode fan_only as custom mode in Alexa (#76148)
* Add support for FAN_ONLY mode

* Tests for fan_only as custom mode
2022-08-04 09:13:20 +02:00
Thomas Hollstegge
f0cc565f6c
Fix Alexa: Only trigger doorbell event on actual state change to "ON" (#74924)
* Alexa: Only trigger doorbell event on actual state change to "ON"

* Remove unnecessary check for new_state

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* First check state is `on` before checking the old state

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-07-14 12:40:53 -07:00
Paulus Schoutsen
7573dc34aa
Treat thermostat unknown state like unavailable in alexa (#74220) 2022-06-30 10:00:10 -07:00
Mike Degatano
9392f59913
Trigger Alexa routines from toggles and buttons (#67889) 2022-06-29 13:56:02 +02:00
w35l3y
beab6e2e5f
Fix ended session when there isn't any response from the user (#72218)
* Fix end session when there isn't any response

This PR fixes #72153

* Added test case as requested

https://github.com/home-assistant/core/pull/72218#discussion_r881584812
2022-06-03 15:32:22 +02:00
J. Nick Koston
24d7a464e1
Refactor logbook to reduce overhead and complexity (#71509) 2022-05-08 21:47:26 -07:00
Erik Montnemery
1aaf78ef99
Remove entity category system in favor of hidden_by (#68550) 2022-05-02 09:33:16 -07:00
Erik Montnemery
e45d4d53dd
Correct time stamp format in Alexa responses (#70267) 2022-04-22 08:44:59 -07:00
Erik Montnemery
dc8e87a6f7
Exclude hidden entities from alexa (#68555) 2022-03-23 12:40:28 +01:00
Paulus Schoutsen
9c440d8aa6
Guard for non-string inputs in Alexa (#67348) 2022-02-27 12:59:05 -08:00
Paulus Schoutsen
bf138c4ffb
Alexa to handle brightness and catch exceptions (#65322) 2022-01-31 15:01:46 -08:00
w35l3y
076faaa4a4
Add support to reprompt user (#65256) 2022-01-31 10:23:26 -08:00
Erik Montnemery
7b8bbc37df
Include entity_id in Alexa state report error log (#64898) 2022-01-25 11:11:06 +01:00
Erik Montnemery
e6899416e1
Suppress Alexa state reports when not authorized (#64064) 2022-01-17 09:14:26 -08:00
Erik Montnemery
c109d59862
Fix comments in Alexa (#64289) 2022-01-17 14:22:04 +01:00
Erik Montnemery
be628a7c4d
Keep track of Alexa authorization status (#63979) 2022-01-13 09:47:31 -08:00
Erik Montnemery
6ffe04b788
Remove constant DEFAULT_CONFIG from alexa tests (#64031) 2022-01-13 11:35:16 +01:00
Franck Nijhof
99b2161365
Add input_button support to Alexa (#62592) 2021-12-23 07:36:45 +01:00
Erik Montnemery
af2e95d891
Guard against missing states in Alexa state updates (#61152) 2021-12-07 12:44:50 +01:00
Franck Nijhof
7a0ff4e2e1
Add button support to Alexa (#60163) 2021-11-23 08:19:13 -08: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
Jan Bouwhuis
a679ebcee7
Patch for Alexa percentage_step to precision (#58062)
* speed_step must be an integer and a divider of 100

* use percentage_step in tests to test patch

* test with not supported percentage_step

* undo change in test_capabilities

* Use a default precision of one not percentage_step

* typo 2

* Update tests/components/alexa/test_smart_home.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/capabilities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-10-20 13:05:11 +02:00
Jan Bouwhuis
e73ca9bd18
Alexa fix Fan support and cleanup (#56053)
* del PowerLevelController, ena fan PowerController

* Use AlexaRangeContoller for speed or default

* Update tests

* no-else-return

* Avoid cases with only one preset_mode

* Only report ghost_mode to Alexa - fix bug

* Add some tests for patched code

* pylint

* pylint and tests with one preset_mode

* correct ghost preset mode check in test

* add tests for RangeController

* ghost preset_mode locale agnostic

* isort

* Update homeassistant/components/alexa/capabilities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-09-24 08:14:45 +02:00
Elliot Morales Solé
097fae0348
Correct Alexa scene activation (#56469)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-09-20 22:51:17 -07:00
Jan Bouwhuis
755835ee2e
Alexa - Remove legacy speed support for fan platform (#55174)
* Remove legacy fan speed support

* remove fan range controller tests

* retrigger tests
2021-09-06 10:19:57 +02:00
J. Nick Koston
4d122fc366
Update alexa lock to support locking, unlocking, jammed (#52841) 2021-07-20 23:21:05 -05:00
Jan Bouwhuis
7403ba1e81
Alexa fan preset_mode support (#50466)
* fan preset_modes

* process preset mode updates from alexa correctly

* add tests

* codecov patch additional tests
2021-05-31 20:58:01 +02:00
Paulus Schoutsen
5ea2dd8ce3
Alexa: Set Equalizer property to retrievable (#50730) 2021-05-17 09:26:37 +02:00
Erik Montnemery
1230c46e1e
Use supported_color_modes in alexa (#49174) 2021-04-14 09:18:49 +02:00
Paulus Schoutsen
05aeff5591
Describe Google Assistant events (#49141)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-13 09:31:01 -07:00
Paulus Schoutsen
2ebca88950
Fix Alexa doorbells (#47257) 2021-03-02 15:13:45 +01:00
Paulus Schoutsen
7c2545af6e
Use async_capture_events to avoid running in executor (#47111) 2021-02-26 13:28:52 -08:00