Fix incorrect patch in flume tests (#130631)
parent
2c8f038c39
commit
a97090e0d5
|
@ -3,8 +3,7 @@
|
|||
from collections.abc import Generator
|
||||
import datetime
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
from unittest.mock import mock_open, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
|
@ -116,7 +115,7 @@ def access_token_fixture(requests_mock: Mocker) -> Generator[None]:
|
|||
status_code=HTTPStatus.OK,
|
||||
json={"data": [token_response]},
|
||||
)
|
||||
with patch("builtins.open", mock_open(read_data=json.dumps(token_response))):
|
||||
with patch("homeassistant.components.flume.coordinator.FlumeAuth.write_token_file"):
|
||||
yield
|
||||
|
||||
|
||||
|
|
|
@ -61,10 +61,6 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize( # Remove when translations fixed
|
||||
"ignore_translations",
|
||||
["component.flume.config.error.invalid_auth"],
|
||||
)
|
||||
@pytest.mark.usefixtures("access_token")
|
||||
async def test_form_invalid_auth(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
||||
"""Test we handle invalid auth."""
|
||||
|
@ -93,10 +89,6 @@ async def test_form_invalid_auth(hass: HomeAssistant, requests_mock: Mocker) ->
|
|||
assert result2["errors"] == {"password": "invalid_auth"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize( # Remove when translations fixed
|
||||
"ignore_translations",
|
||||
["component.flume.config.error.cannot_connect"],
|
||||
)
|
||||
@pytest.mark.usefixtures("access_token", "device_list_timeout")
|
||||
async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
"""Test we handle cannot connect error."""
|
||||
|
@ -118,16 +110,6 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
|||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize( # Remove when translations fixed
|
||||
"ignore_translations",
|
||||
[
|
||||
[
|
||||
"component.flume.config.abort.reauth_successful",
|
||||
"component.flume.config.error.cannot_connect",
|
||||
"component.flume.config.error.invalid_auth",
|
||||
]
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("access_token")
|
||||
async def test_reauth(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
||||
"""Test we can reauth."""
|
||||
|
@ -208,10 +190,6 @@ async def test_reauth(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
|||
assert result4["reason"] == "reauth_successful"
|
||||
|
||||
|
||||
@pytest.mark.parametrize( # Remove when translations fixed
|
||||
"ignore_translations",
|
||||
["component.flume.config.error.cannot_connect"],
|
||||
)
|
||||
@pytest.mark.usefixtures("access_token")
|
||||
async def test_form_no_devices(hass: HomeAssistant, requests_mock: Mocker) -> None:
|
||||
"""Test a device list response that contains no values will raise an error."""
|
||||
|
|
Loading…
Reference in New Issue