Commit Graph

93 Commits

Author SHA1 Message Date
J. Nick Koston
8007bf1c31 Fix REST sensor charset handling to respect Content-Type header (#148223) 2025-07-07 14:32:58 +01:00
J. Nick Koston
03e295ace0 Restore httpx compatibility for non-primitive REST query parameters (#148286) 2025-07-07 08:01:48 -05:00
J. Nick Koston
2ea20ee2ab Fix UTF-8 encoding for REST basic authentication (#148225) 2025-07-06 12:40:19 -05:00
J. Nick Koston
6d28b99344 Preserve httpx boolean behavior in REST integration after aiohttp conversion (#147738) 2025-06-28 17:24:09 -05:00
J. Nick Koston
f8c052e0ce Improve rest error logging (#147736)
* Improve rest error logging

* Improve rest error logging

* Improve rest error logging

* Improve rest error logging

* Improve rest error logging

* top level
2025-06-28 22:18:46 +02:00
Marc Mueller
6c5f7eabff Fix RuntimeWarning in rest tests (#146452) 2025-06-10 15:26:07 +02:00
J. Nick Koston
7573a74cb0 Migrate rest to use aiohttp (#146306) 2025-06-07 13:44:25 -05:00
Petro31
ff2c901930 Update trigger based template entity resolution order (#140660)
* Update trigger based template entity resolution order

* add test

* fix most comments

* Move resolution to base class

* add comment

* remove uncessary if statement

* add more tests

* update availability tests

* update logic stage 1

* phase 2 changes

* fix trigger template entity tests

* fix trigger template entities

* command line tests

* sql tests

* scrape test

* update doc string

* add rest tests

* update sql sensor _update signature

* fix scrape test constructor

* move state check to trigger_entity

* fix comments

* Update homeassistant/components/template/trigger_entity.py

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

* Update homeassistant/helpers/trigger_template_entity.py

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

* Update homeassistant/helpers/trigger_template_entity.py

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

* update command_line and rest

* update scrape

* update sql

* add case to command_line sensor

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-04-25 13:17:25 +02:00
J. Nick Koston
a150e39922 Bump httpx to 0.28.1, httpcore to 1.0.7 along with required deps (#133840) 2025-01-22 12:50:00 +01:00
Erik Montnemery
3e62c6ae2f Move core config functionality to its own module (#129065)
* Move core config functionality to its own module

* Adjust test
2024-10-24 13:34:51 +02:00
epenet
9ce7779bde Use correct constant in rest tests (#122765) 2024-07-29 12:59:57 +02:00
Oleg Kurapov
2cc38b426a Add XML support to RESTful binary sensor (#110062)
* Add XML support to RESTful binary sensor

* Add test for binary sensor with XML input data

* Address mypy validation results by handling None returns

* Use proper incorrect XML instead of blank

* Change failure condition to match the behavior of the library method

* Change error handling for bad XML to expect ExpatError

* Parametrize bad XML test to catch both empty and invalid XML

* Move exception handling out of the shared method

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-05-30 16:29:50 +02:00
epenet
8d8696075b Use registry fixtures in tests (r) (#118293) 2024-05-28 14:23:31 +02:00
Lukasz Szmit
ceaf8f2402 Add support for payload_template in rest component (#107464)
* Add support for payload_template in rest component

* Update homeassistant/components/rest/schema.py

* Update homeassistant/components/rest/data.py

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-04-18 15:22:58 +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
Jan Bouwhuis
a4f52cc622 Use a constant to reference homeassistant domain (#113889)
* Use CONF_CORE to reference `homeassistant` domain

* Just use DOMAIN

* USE DOMAIN for `homeasistant` domain in config_schema.py

* Use DOMAIN_HA as constant for homeassistant domain

* Rename CONF_CORE to DOMAIN_HA

* Rename DOMAIN_HA to HA_DOMAIN

* Use relative import

* Use direct imports
2024-03-23 19:58:39 +01: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
7d6251ca08 Add empty line after module docstring [tests q-s] (#112711) 2024-03-08 14:47:22 +01:00
Marc Mueller
438d3b01b9 Use builtin TimeoutError [o-s] (#109682) 2024-02-05 12:14:37 +01:00
vexofp
c5a3e58994 Pass timeout to httpx in RESTful Switch (#105364)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-19 10:47:42 -10:00
vexofp
327016eaeb Accept HTTP 200 through 206 as success for RESTful Switch (#105358) 2023-12-09 12:45:33 -10:00
Erik Montnemery
25bea91683 Use modern platform path when reporting platform config errors (#104238)
* Use modern platform path when reporting platform config errors

* Update tests

* Address review comment

* Explicitly pass platform domain to log helpers

* Revert overly complicated changes

* Try a simpler solution
2023-12-05 15:06:13 +01:00
Erik Montnemery
80813e992d Improve formatting of component errors (#104081)
* Improve formatting of component errors

* Update tests
2023-11-17 23:01:00 +01:00
Erik Montnemery
dd7670cacf Improve errors for component configuration with missing keys (#103982) 2023-11-15 10:47:05 +01:00
G Johansson
61c17291fb Move TemplateEntity to template (#98957)
* Move TemplateEntity to template

* Rename template_entity in helpers
2023-08-24 15:37:04 +02:00
G Johansson
ed18c6a013 Refactor Rest Switch with ManualTriggerEntity (#97403)
* Refactor Rest Switch with ManualTriggerEntity

* Fix test

* Fix 2

* review comments

* remove async_added_to_hass

* update on startup
2023-08-15 11:43:47 +02:00
G Johansson
aacb8aecfc Refactor Rest Sensor with ManualTriggerEntity (#97396)
* ManualTriggerEntity for rest sensor

* add availability test

* review comments

* last fixes
2023-08-10 21:46:56 +02:00
G Johansson
4531dbbe62 Refactor Rest Binary sensor with ManualTriggerEntity (#97400)
* Refactor Rest Binary sensor w/ ManualTriggerEntity

* test availability

* review comments

* Use super

* Fix config
2023-08-10 12:59:23 +02:00
Allen Porter
12129e9d21 Update service call return values and error handling (#94657)
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00
epenet
580b09d0f2 Refactor XML parsing in rest (#94268)
* Refactor XML parsing in rest

* Adjust caplog check

* Adjust

* Rename

* Simplify
2023-06-15 09:15:25 +02:00
epenet
802e907a35 Migrate rest switch to httpx (#90768) 2023-05-05 14:43:39 +02:00
Michael
323d16cc21 Add ssl_cipher_list option to rest (#91078) 2023-04-15 11:22:41 -10:00
Michael
0916701a0b Catch ssl errors in rest (#91074)
* catch ssl.SSLError

* add test

* fail setup on ssl error

* adjust tests
2023-04-12 06:51:41 +02:00
epenet
f24634e198 Use domain constants in rest tests (#90765) 2023-04-04 14:33:41 +02:00
epenet
02e2e4d039 Add rest encoding test (#90404)
* Add rest encoding test

* docstring
2023-03-28 16:29:24 +02:00
Erik Montnemery
cf7e500a8e Support translating entity names (#88242) 2023-03-12 15:55:04 +01:00
epenet
c1589d3c89 Adjust invalid test values in rest (#86009) 2023-01-16 13:37:38 +01:00
Michael
72d3fa6d89 Replace the usage of unit constants by enumerations in Tests [o-r] (#85936) 2023-01-15 14:50:24 +01:00
Franck Nijhof
2e92fefc0a Fix uom/device class mismatches in tests (#84372) 2022-12-21 22:47:59 +01:00
Franck Nijhof
762eb57636 Validate state class and unit of measurement for non-numeric sensors (#83344)
* Validate state class and unit of measurement for non-numeric sensors

* Remove duration

* Fix rest tests
2022-12-06 00:07:02 +01:00
epenet
1baa5c12c0 Fix rest schema (#81857) 2022-11-11 10:08:26 -06:00
epenet
c585817e67 Adjust REST schema validation (#81723)
fixes undefined
2022-11-08 11:18:58 +01:00
epenet
934cec9778 Modernize rest switch tests (#81306)
* Adjust rest switch tests to use schema validation

* Simplify

* Use async_setup_component in tests

* Rewrite tests

* Add patch

* Remove patch

* Adjust mock
2022-11-07 13:08:05 +01:00
epenet
a0ed91e30c Add type hints to rest tests (#81304) 2022-10-31 15:30:29 +01:00
Erik Montnemery
146ff83a16 Migrate rest binary_sensor and switch to TemplateEntity (#73307) 2022-06-28 13:53:38 -07:00
J. Nick Koston
dca4d3cd61 Significantly improve yaml load times when the C loader is available (#73337) 2022-06-13 08:44:46 -10:00
Erik Montnemery
5987266e56 Refactor template entity to allow reuse (#72753)
* Refactor template entity to allow reuse

* Fix schema and default name

* Add tests

* Update requirements

* Improve test

* Tweak TemplateSensor initializer

* Drop attributes and availability from TemplateEntity

* Use rest sensor for proof of concept

* Revert changes in SNMP sensor

* Don't set _attr_should_poll in mixin class

* Update requirements
2022-06-08 15:55:49 +02:00
epenet
831e2ace9c Prettify yaml (tests) (#68891) 2022-03-30 11:26:08 +02:00
Simone Chemelli
969930b9c9 Remove debug print (#63460) 2022-01-05 15:34:33 +01:00
Robert Hillis
d9788c2447 Use platform enums in rest tests (#62564) 2021-12-22 07:31:55 -05:00