Make the frontend available sooner (Part 1 of 2) (#36263)
* Part 1 of 2 (no breaking changes in part 1). When integrations configured via the UI block startup or fail to start, the webserver can remain offline which make it is impossible to recover without manually changing files in .storage since the UI is not available. This change is the foundation that part 2 will build on and enable a listener to start the webserver when the frontend is finished loading. Frontend Changes (home-assistant/frontend#6068) * Address review comments * bump timeout to 1800s, adjust comment * bump timeout to 4h * remove timeout failsafe * and the test
This commit is contained in:
1 parent
7338feb659
commit
578d4a9b6a
13 files changed
+126
-62
No files matched your search
@@ -11,7 +11,7 @@ from tests.async_mock import Mock
|
||||
async def get_client(aiohttp_client, validator):
|
||||
"""Generate a client that hits a view decorated with validator."""
|
||||
app = web.Application()
|
||||
app["hass"] = Mock(is_running=True)
|
||||
app["hass"] = Mock(is_stopping=False)
|
||||
|
||||
class TestView(HomeAssistantView):
|
||||
url = "/"
|
||||
|
||||
@@ -19,7 +19,13 @@ from tests.async_mock import AsyncMock, Mock
|
||||
@pytest.fixture
|
||||
def mock_request():
|
||||
"""Mock a request."""
|
||||
return Mock(app={"hass": Mock(is_running=True)}, match_info={})
|
||||
return Mock(app={"hass": Mock(is_stopping=False)}, match_info={})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_request_with_stopping():
|
||||
"""Mock a request."""
|
||||
return Mock(app={"hass": Mock(is_stopping=True)}, match_info={})
|
||||
|
||||
|
||||
async def test_invalid_json(caplog):
|
||||
@@ -55,3 +61,11 @@ async def test_handling_service_not_found(mock_request):
|
||||
Mock(requires_auth=False),
|
||||
AsyncMock(side_effect=ServiceNotFound("test", "test")),
|
||||
)(mock_request)
|
||||
|
||||
|
||||
async def test_not_running(mock_request_with_stopping):
|
||||
"""Test we get a 503 when not running."""
|
||||
response = await request_handler_factory(
|
||||
Mock(requires_auth=False), AsyncMock(side_effect=Unauthorized)
|
||||
)(mock_request_with_stopping)
|
||||
assert response.status == 503
|
||||
Reference in new issue
Block a user