Fix auth for hass.io (#17318)

* Update test_auth.py

* Update auth.py

* Update test_auth.py
This commit is contained in:
Pascal Vizeli 2018-10-11 01:02:00 +02:00 committed by GitHub
parent 8d9da4e7b9
commit 3f87d41381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -4,8 +4,7 @@ from ipaddress import ip_address
import os import os
from aiohttp import web from aiohttp import web
from aiohttp.web_exceptions import ( from aiohttp.web_exceptions import HTTPForbidden, HTTPNotFound
HTTPForbidden, HTTPNotFound, HTTPUnauthorized)
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback from homeassistant.core import callback
@ -72,4 +71,4 @@ class HassIOAuth(HomeAssistantView):
try: try:
await provider.async_validate_login(username, password) await provider.async_validate_login(username, password)
except HomeAssistantError: except HomeAssistantError:
raise HTTPUnauthorized() from None raise HTTPForbidden() from None

View File

@ -50,7 +50,7 @@ async def test_login_error(hass, hassio_client):
) )
# Check we got right response # Check we got right response
assert resp.status == 401 assert resp.status == 403
mock_login.assert_called_with("test", "123456") mock_login.assert_called_with("test", "123456")