1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add config for trusted networks auth provider (#21111)

* Add config for trusted networks auth provider

* Lint

* Fix typing

* Fix pylint

* Fix lint

* Add some log information

* Add http.trusted_networks deprecated warning

* Remove log info

* Lint
This commit is contained in:
Jason Hu
2019-02-26 14:42:48 -08:00
committed by Paulus Schoutsen
parent 5c2f997394
commit 7bae76843c
6 changed files with 72 additions and 43 deletions

View File

@@ -5,6 +5,7 @@ import os
import unittest
import unittest.mock as mock
from collections import OrderedDict
from ipaddress import ip_network
import asynctest
import pytest
@@ -891,12 +892,14 @@ async def test_auth_provider_config_default_trusted_networks(hass):
}
if hasattr(hass, 'auth'):
del hass.auth
await config_util.async_process_ha_core_config(hass, core_config,
has_trusted_networks=True)
await config_util.async_process_ha_core_config(
hass, core_config, trusted_networks=['192.168.0.1'])
assert len(hass.auth.auth_providers) == 2
assert hass.auth.auth_providers[0].type == 'homeassistant'
assert hass.auth.auth_providers[1].type == 'trusted_networks'
assert hass.auth.auth_providers[1].trusted_networks[0] == ip_network(
'192.168.0.1')
async def test_disallowed_auth_provider_config(hass):