Remove direct authentication via trusted networks or API password (#27656)

* Remove direct authentication via trusted networks and API password

* Fix tests
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-10-14 14:56:45 -07:00
1 parent 97478d1ef4
commit 3231e22ddf
33 files changed
+114 -423

No files matched your search

+2 -11
View File
@@ -1,11 +1,9 @@
"""The tests for the hassio component."""
from unittest.mock import patch, Mock
from homeassistant.const import HTTP_HEADER_HA_AUTH
from homeassistant.exceptions import HomeAssistantError
from tests.common import mock_coro
from . import API_PASSWORD
async def test_login_success(hass, hassio_client):
@@ -18,7 +16,6 @@ async def test_login_success(hass, hassio_client):
resp = await hassio_client.post(
"/api/hassio_auth",
json={"username": "test", "password": "123456", "addon": "samba"},
headers={HTTP_HEADER_HA_AUTH: API_PASSWORD},
)
# Check we got right response
@@ -36,7 +33,6 @@ async def test_login_error(hass, hassio_client):
resp = await hassio_client.post(
"/api/hassio_auth",
json={"username": "test", "password": "123456", "addon": "samba"},
headers={HTTP_HEADER_HA_AUTH: API_PASSWORD},
)
# Check we got right response
@@ -51,9 +47,7 @@ async def test_login_no_data(hass, hassio_client):
"HassAuthProvider.async_validate_login",
Mock(side_effect=HomeAssistantError()),
) as mock_login:
resp = await hassio_client.post(
"/api/hassio_auth", headers={HTTP_HEADER_HA_AUTH: API_PASSWORD}
)
resp = await hassio_client.post("/api/hassio_auth")
# Check we got right response
assert resp.status == 400
@@ -68,9 +62,7 @@ async def test_login_no_username(hass, hassio_client):
Mock(side_effect=HomeAssistantError()),
) as mock_login:
resp = await hassio_client.post(
"/api/hassio_auth",
json={"password": "123456", "addon": "samba"},
headers={HTTP_HEADER_HA_AUTH: API_PASSWORD},
"/api/hassio_auth", json={"password": "123456", "addon": "samba"}
)
# Check we got right response
@@ -93,7 +85,6 @@ async def test_login_success_extra(hass, hassio_client):
"addon": "samba",
"path": "/share",
},
headers={HTTP_HEADER_HA_AUTH: API_PASSWORD},
)
# Check we got right response