Use HTTP_NOT_FOUND constant (#33835)

This commit is contained in:
springstan authored and GitHub committed 2020-04-09 00:57:47 +02:00
1 parent ac9429988b
commit 9a40d5b7ed
29 files changed
+98 -78

No files matched your search

+4 -3
View File
@@ -4,6 +4,7 @@ from unittest.mock import Mock, patch
from homeassistant.components.cloud import GACTIONS_SCHEMA
from homeassistant.components.cloud.google_config import CloudGoogleConfig
from homeassistant.components.google_assistant import helpers as ga_helpers
from homeassistant.const import HTTP_NOT_FOUND
from homeassistant.helpers.entity_registry import EVENT_ENTITY_REGISTRY_UPDATED
from homeassistant.util.dt import utcnow
@@ -41,14 +42,14 @@ async def test_sync_entities(aioclient_mock, hass, cloud_prefs):
GACTIONS_SCHEMA({}),
"mock-user-id",
cloud_prefs,
Mock(auth=Mock(async_check_token=Mock(side_effect=mock_coro)),),
Mock(auth=Mock(async_check_token=Mock(side_effect=mock_coro))),
)
with patch(
"hass_nabucasa.cloud_api.async_google_actions_request_sync",
return_value=mock_coro(Mock(status=404)),
return_value=mock_coro(Mock(status=HTTP_NOT_FOUND)),
) as mock_request_sync:
assert await config.async_sync_entities("user") == 404
assert await config.async_sync_entities("user") == HTTP_NOT_FOUND
assert len(mock_request_sync.mock_calls) == 1