Use HTTP_INTERNAL_SERVER_ERROR constant (#33832)

This commit is contained in:
springstan 2020-04-08 23:20:03 +02:00 committed by GitHub
parent 15ab63a4c2
commit fb8f8133a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 122 additions and 69 deletions

View file

@ -17,6 +17,7 @@ from homeassistant.components.smartthings.const import (
SIGNAL_SMARTTHINGS_UPDATE,
SUPPORTED_PLATFORMS,
)
from homeassistant.const import HTTP_INTERNAL_SERVER_ERROR
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.setup import async_setup_component
@ -80,7 +81,7 @@ async def test_recoverable_api_errors_raise_not_ready(
config_entry.add_to_hass(hass)
request_info = Mock(real_url="http://example.com")
smartthings_mock.app.side_effect = ClientResponseError(
request_info=request_info, history=None, status=500
request_info=request_info, history=None, status=HTTP_INTERNAL_SERVER_ERROR
)
with pytest.raises(ConfigEntryNotReady):
@ -96,7 +97,7 @@ async def test_scenes_api_errors_raise_not_ready(
smartthings_mock.app.return_value = app
smartthings_mock.installed_app.return_value = installed_app
smartthings_mock.scenes.side_effect = ClientResponseError(
request_info=request_info, history=None, status=500
request_info=request_info, history=None, status=HTTP_INTERNAL_SERVER_ERROR
)
with pytest.raises(ConfigEntryNotReady):
await smartthings.async_setup_entry(hass, config_entry)
@ -325,7 +326,7 @@ async def test_remove_entry_installedapp_api_error(
request_info = Mock(real_url="http://example.com")
# Arrange
smartthings_mock.delete_installed_app.side_effect = ClientResponseError(
request_info=request_info, history=None, status=500
request_info=request_info, history=None, status=HTTP_INTERNAL_SERVER_ERROR
)
# Act
with pytest.raises(ClientResponseError):
@ -354,7 +355,7 @@ async def test_remove_entry_app_api_error(hass, config_entry, smartthings_mock):
# Arrange
request_info = Mock(real_url="http://example.com")
smartthings_mock.delete_app.side_effect = ClientResponseError(
request_info=request_info, history=None, status=500
request_info=request_info, history=None, status=HTTP_INTERNAL_SERVER_ERROR
)
# Act
with pytest.raises(ClientResponseError):