mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Fix auth for hass.io (#17318)
* Update test_auth.py * Update auth.py * Update test_auth.py
This commit is contained in:
parent
8d9da4e7b9
commit
3f87d41381
@ -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
|
||||||
|
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user