Bumps aiohttp to 3.6.0 (#26728)
This commit is contained in:
1 parent
468deef326
commit
a8a485abf7
6 files changed
+51
-17
No files matched your search
@@ -84,7 +84,10 @@ async def test_token_unauthorized(hass, smartthings_mock):
|
||||
flow = SmartThingsFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(None, None, status=401)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=401
|
||||
)
|
||||
|
||||
result = await flow.async_step_user({"access_token": str(uuid4())})
|
||||
|
||||
@@ -98,7 +101,10 @@ async def test_token_forbidden(hass, smartthings_mock):
|
||||
flow = SmartThingsFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(None, None, status=403)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=403
|
||||
)
|
||||
|
||||
result = await flow.async_step_user({"access_token": str(uuid4())})
|
||||
|
||||
@@ -113,7 +119,10 @@ async def test_webhook_error(hass, smartthings_mock):
|
||||
flow.hass = hass
|
||||
|
||||
data = {"error": {}}
|
||||
error = APIResponseError(None, None, data=data, status=422)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
error = APIResponseError(
|
||||
request_info=request_info, history=None, data=data, status=422
|
||||
)
|
||||
error.is_target_error = Mock(return_value=True)
|
||||
|
||||
smartthings_mock.apps.side_effect = error
|
||||
@@ -131,7 +140,10 @@ async def test_api_error(hass, smartthings_mock):
|
||||
flow.hass = hass
|
||||
|
||||
data = {"error": {}}
|
||||
error = APIResponseError(None, None, data=data, status=400)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
error = APIResponseError(
|
||||
request_info=request_info, history=None, data=data, status=400
|
||||
)
|
||||
|
||||
smartthings_mock.apps.side_effect = error
|
||||
|
||||
@@ -147,7 +159,10 @@ async def test_unknown_api_error(hass, smartthings_mock):
|
||||
flow = SmartThingsFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(None, None, status=404)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.apps.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=404
|
||||
)
|
||||
|
||||
result = await flow.async_step_user({"access_token": str(uuid4())})
|
||||
|
||||
|
||||
@@ -54,7 +54,10 @@ async def test_unrecoverable_api_errors_create_new_flow(
|
||||
"""
|
||||
assert await async_setup_component(hass, "persistent_notification", {})
|
||||
config_entry.add_to_hass(hass)
|
||||
smartthings_mock.app.side_effect = ClientResponseError(None, None, status=401)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.app.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=401
|
||||
)
|
||||
|
||||
# Assert setup returns false
|
||||
result = await smartthings.async_setup_entry(hass, config_entry)
|
||||
@@ -75,7 +78,10 @@ async def test_recoverable_api_errors_raise_not_ready(
|
||||
):
|
||||
"""Test config entry not ready raised for recoverable API errors."""
|
||||
config_entry.add_to_hass(hass)
|
||||
smartthings_mock.app.side_effect = ClientResponseError(None, None, status=500)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.app.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=500
|
||||
)
|
||||
|
||||
with pytest.raises(ConfigEntryNotReady):
|
||||
await smartthings.async_setup_entry(hass, config_entry)
|
||||
@@ -86,9 +92,12 @@ async def test_scenes_api_errors_raise_not_ready(
|
||||
):
|
||||
"""Test if scenes are unauthorized we continue to load platforms."""
|
||||
config_entry.add_to_hass(hass)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.app.return_value = app
|
||||
smartthings_mock.installed_app.return_value = installed_app
|
||||
smartthings_mock.scenes.side_effect = ClientResponseError(None, None, status=500)
|
||||
smartthings_mock.scenes.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=500
|
||||
)
|
||||
with pytest.raises(ConfigEntryNotReady):
|
||||
await smartthings.async_setup_entry(hass, config_entry)
|
||||
|
||||
@@ -140,10 +149,13 @@ async def test_scenes_unauthorized_loads_platforms(
|
||||
):
|
||||
"""Test if scenes are unauthorized we continue to load platforms."""
|
||||
config_entry.add_to_hass(hass)
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.app.return_value = app
|
||||
smartthings_mock.installed_app.return_value = installed_app
|
||||
smartthings_mock.devices.return_value = [device]
|
||||
smartthings_mock.scenes.side_effect = ClientResponseError(None, None, status=403)
|
||||
smartthings_mock.scenes.side_effect = ClientResponseError(
|
||||
request_info=request_info, history=None, status=403
|
||||
)
|
||||
mock_token = Mock()
|
||||
mock_token.access_token.return_value = str(uuid4())
|
||||
mock_token.refresh_token.return_value = str(uuid4())
|
||||
@@ -290,12 +302,13 @@ async def test_remove_entry_app_in_use(hass, config_entry, smartthings_mock):
|
||||
|
||||
async def test_remove_entry_already_deleted(hass, config_entry, smartthings_mock):
|
||||
"""Test handles when the apps have already been removed."""
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
# Arrange
|
||||
smartthings_mock.delete_installed_app.side_effect = ClientResponseError(
|
||||
None, None, status=403
|
||||
request_info=request_info, history=None, status=403
|
||||
)
|
||||
smartthings_mock.delete_app.side_effect = ClientResponseError(
|
||||
None, None, status=403
|
||||
request_info=request_info, history=None, status=403
|
||||
)
|
||||
# Act
|
||||
await smartthings.async_remove_entry(hass, config_entry)
|
||||
@@ -308,9 +321,10 @@ async def test_remove_entry_installedapp_api_error(
|
||||
hass, config_entry, smartthings_mock
|
||||
):
|
||||
"""Test raises exceptions removing the installed app."""
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
# Arrange
|
||||
smartthings_mock.delete_installed_app.side_effect = ClientResponseError(
|
||||
None, None, status=500
|
||||
request_info=request_info, history=None, status=500
|
||||
)
|
||||
# Act
|
||||
with pytest.raises(ClientResponseError):
|
||||
@@ -337,8 +351,9 @@ async def test_remove_entry_installedapp_unknown_error(
|
||||
async def test_remove_entry_app_api_error(hass, config_entry, smartthings_mock):
|
||||
"""Test raises exceptions removing the app."""
|
||||
# Arrange
|
||||
request_info = Mock(real_url="http://example.com")
|
||||
smartthings_mock.delete_app.side_effect = ClientResponseError(
|
||||
None, None, status=500
|
||||
request_info=request_info, history=None, status=500
|
||||
)
|
||||
# Act
|
||||
with pytest.raises(ClientResponseError):
|
||||
|
||||
Reference in new issue
Block a user