Commit Graph

69 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
2ea20ee2ab Fix UTF-8 encoding for REST basic authentication (#148225) 2025-07-06 12:40:19 -05:00
Marc Mueller
6c5f7eabff Fix RuntimeWarning in rest tests (#146452) 2025-06-10 15:26:07 +02:00
Eliz
c73383ded3 Fix missing head forwarding in ingress (#144231)
* Add support for connect, head and trace in ingress

* added tests

* update the testutil

* fix

* fix empty space

* removed connect

* remove trace
2025-05-05 19:11:41 +02:00
J. Nick Koston
31200040da Bump aiohttp to 3.10.6rc2 (#126468) 2024-09-24 08:51:08 +02:00
epenet
0a846cfca8 Add missing hass type in tests/test_util (#124043) 2024-08-16 13:43:43 +02:00
epenet
3e967700fd Add missing return type in test __init__ method (part 2) (#123939)
* Add missing return type in test __init__ method (part 2)

* Adjust

* One more

* One more

* More
2024-08-14 17:59:15 +02:00
epenet
5608301178 Add missing return type in test __init__ methods (#123932)
* Add missing return type in test __init__ methods

* Adjust
2024-08-14 16:48:52 +02:00
Marc Mueller
6be4ef8a1f Improve contextmanager typing (#122250) 2024-07-20 14:09:37 +02:00
epenet
8e1103050c Fix dangerous-default-value warnings in core tests (#119568) 2024-06-13 17:10:37 +02:00
Sid
82a60fe8ad Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Marc Mueller
aa16a9d707 Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00
Marc Mueller
a6b842f818 Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +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
J. Nick Koston
54c98f32c2 Bump aiohttp to 3.9.0rc0 for python 3.12 only (#103507)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2023-11-15 01:02:14 +01:00
Allen Porter
787fb3b954 Improve OAuth error handling in configuration flows (#103157)
* Improve OAuth error handling in configuration flows

* Update strings for all integrations that use oauth2 config flow

* Remove invalid_auth strings

* Revert change to release

* Revert close change in aiohttp mock
2023-11-11 11:02:51 +01:00
Marc Mueller
529bc507a0 Fix aiohttp test RuntimeWarning (#98568) 2023-08-17 17:42:20 +02:00
Erik Montnemery
3de402bd15 Fix AiohttpClientMockResponse.release (#98458) 2023-08-15 09:22:42 -05:00
epenet
a16e298599 Adjust json imports in tests (#88248) 2023-02-17 19:13:48 +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
Paulus Schoutsen
9ed629d838 Fix some pytest warning for helpers (#85283) 2023-01-06 09:21:46 +01:00
J. Nick Koston
da027fa390 JSON serialize NamedTuple subclasses with aiohttp (#74971) 2022-07-11 14:46:55 -07:00
J. Nick Koston
2f78faa718 Make aiohttp mockers aware of the json loads kwarg (#73939) 2022-06-24 08:44:35 +02:00
Erik Montnemery
ce302f4540 Play first item in m3u and pls playlists when casting (#70047)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-26 13:16:37 -07:00
Franck Nijhof
fa09cf663e Update black to 22.1.0 (#65788) 2022-02-05 14:19:37 +01:00
Ville Skyttä
2730a27fd0 Use HTTPStatus instead of HTTP_* constants in various test mocks (#56543) 2021-10-01 15:52:45 -07:00
Michael Chisholm
a28fd7d61b Config-flow for DLNA-DMR integration (#55267)
* Modernize dlna_dmr component: configflow, test, types

* Support config-flow with ssdp discovery
* Add unit tests
* Enforce strict typing
* Gracefully handle network devices (dis)appearing

* Fix Aiohttp mock response headers type to match actual response class

* Fixes from code review

* Fixes from code review

* Import device config in flow if unavailable at hass start

* Support SSDP advertisements

* Ignore bad BOOTID, fix ssdp:byebye handling

* Only listen for events on interface connected to device

* Release all listeners when entities are removed

* Warn about deprecated dlna_dmr configuration

* Use sublogger for dlna_dmr.config_flow for easier filtering

* Tests for dlna_dmr.data module

* Rewrite DMR tests for HA style

* Fix DMR strings: "Digital Media *Renderer*"

* Update DMR entity state and device info when changed

* Replace deprecated async_upnp_client State with TransportState

* supported_features are dynamic, based on current device state

* Cleanup fully when subscription fails

* Log warnings when device connection fails unexpectedly

* Set PARALLEL_UPDATES to unlimited

* Fix spelling

* Fixes from code review

* Simplify has & can checks to just can, which includes has

* Treat transitioning state as playing (not idle) to reduce UI jerking

* Test if device is usable

* Handle ssdp:update messages properly

* Fix _remove_ssdp_callbacks being shared by all DlnaDmrEntity instances

* Fix tests for transitioning state

* Mock DmrDevice.is_profile_device (added to support embedded devices)

* Use ST & NT SSDP headers to find DMR devices, not deviceType

The deviceType is extracted from the device's description XML, and will not
be what we want when dealing with embedded devices.

* Use UDN from SSDP headers, not device description, as unique_id

The SSDP headers have the UDN of the embedded device that we're interested
in, whereas the device description (`ATTR_UPNP_UDN`) field will always be
for the root device.

* Fix DMR string English localization

* Test config flow with UDN from SSDP headers

* Bump async-upnp-client==0.22.1, fix flake8 error

* fix test for remapping

* DMR HA Device connections based on root and embedded UDN

* DmrDevice's UpnpDevice is now named profile_device

* Use device type from SSDP headers, not device description

* Mark dlna_dmr constants as Final

* Use embedded device UDN and type for unique ID when connected via URL

* More informative connection error messages

* Also match SSDP messages on NT headers

The NT header is to ssdp:alive messages what ST is to M-SEARCH responses.

* Bump async-upnp-client==0.22.2

* fix merge

* Bump async-upnp-client==0.22.3

Co-authored-by: Steven Looman <steven.looman@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-27 15:47:01 -05:00
J. Nick Koston
40450b9cfd Detach aiohttp.ClientSession created by config entry setup on unload (#48908) 2021-04-09 10:14:33 -07:00
Vladimír Záhradník
ee55223065 SSDP response decode: replace invalid utf-8 characters (#42681)
* SSDP response decode: replace invalid utf-8 characters

* Add test to validate replaced data

Co-authored-by: Joakim Plate <elupus@ecce.se>
2021-01-31 17:59:14 +01:00
Robert Svensson
da4404e8cf Introduce reauthentication flow to UniFi integration (#45360)
* Improve site selection

* Reauth flow and tests
Add **kwargs to mock_aiohttp_client create_session to support inputting verify_ssl and cookie_jar

* Update homeassistant/components/unifi/config_flow.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Minor improvements

* Improve coverage

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-01-20 22:10:40 +01:00
J. Nick Koston
6822190772 Fix unmocked https in the test suite (#42316) 2020-10-25 07:16:23 -05:00
David F. Mulcahey
f1fd8aa51f Add support for Flo by Moen water shutoff devices (#38171) 2020-08-10 14:19:38 +02:00
Ziv
ea9f1376a6 Fix docstring in test_utils/aiohttp.py (#34040)
* fix docstring

* fixed empty spaces
2020-04-11 20:20:19 +02:00
Ziv
e88af54016 Fix docstring in test_util/aiohttp.py (#34024) 2020-04-11 15:26:54 +02:00
Ziv
302e631984 Ability to mock long poll requests + refactor qwikswitch unit… (#33804)
* added the ability to mock a "long poll" get request by setting up the
waiting request and feeding responses to it
with this, refactored the qwikswitch test so it doesn't use global variables
and is more understandable and maintainable

* added import asyncio from merge

* added assert that first call with long_poll has empty content

* passing json instead of the binary string

* use json instead of text in mock requests

* refactored to use a proxy

* return the proxy also for the http methods other than get

* refactored so any side_effect can be used and created the long_poll side effect

* simplified by using kwargs
needed to move the json->text->content logic from mocker to mockrequest

* no need to explicitly define method and url
2020-04-10 14:57:39 -07:00
Franck Nijhof
60bc517d01 Collection of core tests improvements (#33757)
* Collection of core tests improvements

* Added some more

* Fix aiohttp client response release
2020-04-07 09:33:23 -07:00
Bas Nijholt
f60125b5c9 Sort imports according to PEP8 for 'tests' (#29791) 2019-12-09 16:52:24 +01:00
Franck Nijhof
a8a485abf7 Bumps aiohttp to 3.6.0 (#26728) 2019-09-19 20:34:41 +02:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Pascal Vizeli
7a78d65633 Fix ingress bug with Firefox (#23121)
* Fix ingress bug with Firefox

* Fix mock

* Fix tests

* Fix test lint
2019-04-15 15:27:13 -07:00
Pascal Vizeli
6829ecad9d Hass.io ingress (#22505)
* Fix API stream of snapshot / Add ingress

* fix lint

* Fix stream handling

* Cleanup api handling

* fix typing

* Set proxy header

* Use header constant

* Enable the ingress setup

* fix lint

* Fix name

* Fix tests

* fix lint

* forward params

* Add tests for ingress

* Cleanup cookie handling with aiohttp 3.5

* Add more tests

* Fix tests

* Fix lint

* Fix header handling for steam

* forward header too

* fix lint

* fix flake
2019-04-01 14:16:16 +02:00
Paulus Schoutsen
fd21d6cc9d Add Hass.io user headers to supervisor proxy 2019-01-11 10:00:38 -08:00
Paulus Schoutsen
962358bf87 Fix cloud const (#19052)
* Fix cloud const

* Fix tests
2018-12-06 09:20:53 +01:00
Paulus Schoutsen
d1e1b9b38a Deprecated stuff (#16019)
* Use async with for locks

* Fix regex in template test

* Close session correctly

* Use correct current_task method

* push camera cleanup

* Lint

* Revert current_task

* Update websocket_api.py

* Mock executor_job betteR

* Fix async_create_task mock
2018-08-20 16:34:18 +02:00
Paulus Schoutsen
0ab3e7a92a Add IndieAuth 4.2.2 redirect uri at client id (#15911)
* Add IndieAuth 4.2.2 redirect uri at client id

* Fix tests

* Add comment

* Limit to first 10kB of each page
2018-08-10 18:09:42 +02:00
Andrey
02238b6412 Add python 3.7 to travis and tox (#14523)
* Add python 3.7 to travis and tox

* Use pyyaml from github

* Don't version constraints

* Fix version tag

* Change to new pyyaml release

* Python 3.7 requires xenial

* Fix namespace detection

* Use correct RegEx type

* Update pexpect to 4.6

* Use correct validation for dictionaries

* Disable Py37 incompatible packages

* Upgrade all pexpect to 4.6

* Add explicit None as default param
2018-07-07 10:48:02 -04:00
Paulus Schoutsen
89a19c89a7 Fix aiohttp deprecation warnings (#13240)
* Fix aiohttp deprecation warnings

* Fix Ring deprecation warning

* Lint
2018-03-15 21:49:49 +01:00
Paulus Schoutsen
67c49a7662 Add config flow for Hue (#12830)
* Add config flow for Hue

* Upgrade to aiohue 0.2

* Fix tests

* Add tests

* Add aiohue to test requirements

* Bump aiohue dependency

* Lint

* Lint

* Fix aiohttp mock

* Lint

* Fix tests
2018-03-03 21:28:04 -08:00
Ville Skyttä
cab6c694c5 Flake8 bugbear fixes (#12072)
* Don't use mutable argument defaults (bugbear B006)

* Use callable(x) instead of hasattr(x, '__call__') (bugbear B004)

* Remove/mark unused loop control variables (bugbear B007)

* Fix stripping protocol from kodi host name (bugbear B005)

* Fix plant daily history add default date (bugbear B008)
2018-01-30 14:44:05 -08:00