mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Cleanup the rest reload test to use the pytest requests_mock fixture (#39282)
This commit is contained in:
parent
715fe4eef8
commit
79f4b6eb6b
@ -681,11 +681,11 @@ class TestRestData(unittest.TestCase):
|
|||||||
assert self.rest.data is None
|
assert self.rest.data is None
|
||||||
|
|
||||||
|
|
||||||
async def test_reload(hass):
|
async def test_reload(hass, requests_mock):
|
||||||
"""Verify we can reload reset sensors."""
|
"""Verify we can reload reset sensors."""
|
||||||
|
|
||||||
with requests_mock.Mocker() as mock_req:
|
requests_mock.get("http://localhost", text="test data")
|
||||||
mock_req.get("http://localhost", text="test data")
|
|
||||||
await async_setup_component(
|
await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
"sensor",
|
"sensor",
|
||||||
@ -709,10 +709,7 @@ async def test_reload(hass):
|
|||||||
yaml_path = path.join(
|
yaml_path = path.join(
|
||||||
_get_fixtures_base_path(), "fixtures", "rest/configuration.yaml",
|
_get_fixtures_base_path(), "fixtures", "rest/configuration.yaml",
|
||||||
)
|
)
|
||||||
with patch.object(
|
with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
|
||||||
hass_config, "YAML_CONFIG_FILE", yaml_path
|
|
||||||
), requests_mock.Mocker() as mock_req:
|
|
||||||
mock_req.get("http://localhost", text="test data 2")
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
"rest", SERVICE_RELOAD, {}, blocking=True,
|
"rest", SERVICE_RELOAD, {}, blocking=True,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user