Fail fetch auth providers if onboarding required (#16454)

This commit is contained in:
Paulus Schoutsen authored and Paulus Schoutsen committed 2018-09-11 21:44:30 +02:00
1 parent 968809c991
commit 44d210698e
2 files changed
+27 -3

No files matched your search

+15
View File
@@ -1,4 +1,6 @@
"""Tests for the login flow."""
from unittest.mock import patch
from . import async_setup_auth
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI
@@ -16,6 +18,19 @@ async def test_fetch_auth_providers(hass, aiohttp_client):
}]
async def test_fetch_auth_providers_onboarding(hass, aiohttp_client):
"""Test fetching auth providers."""
client = await async_setup_auth(hass, aiohttp_client)
with patch('homeassistant.components.onboarding.async_is_onboarded',
return_value=False):
resp = await client.get('/auth/providers')
assert resp.status == 400
assert await resp.json() == {
'message': 'Onboarding not finished',
'code': 'onboarding_required',
}
async def test_cannot_get_flows_in_progress(hass, aiohttp_client):
"""Test we cannot get flows in progress."""
client = await async_setup_auth(hass, aiohttp_client, [])