diff --git a/homeassistant/auth/providers/trusted_networks.py b/homeassistant/auth/providers/trusted_networks.py index a6c4c19b02f..04db5fc287b 100644 --- a/homeassistant/auth/providers/trusted_networks.py +++ b/homeassistant/auth/providers/trusted_networks.py @@ -46,7 +46,7 @@ CONFIG_SCHEMA = AUTH_PROVIDER_SCHEMA.extend( [ vol.Or( cv.uuid4_hex, - vol.Schema({vol.Required(CONF_GROUP): cv.uuid4_hex}), + vol.Schema({vol.Required(CONF_GROUP): str}), ) ], ) diff --git a/tests/auth/providers/test_trusted_networks.py b/tests/auth/providers/test_trusted_networks.py index 53d1f0a9fa7..a098eea28e0 100644 --- a/tests/auth/providers/test_trusted_networks.py +++ b/tests/auth/providers/test_trusted_networks.py @@ -116,6 +116,32 @@ def manager_bypass_login(hass, store, provider_bypass_login): ) +async def test_config_schema(): + """Test CONFIG_SCHEMA.""" + # Valid configuration + tn_auth.CONFIG_SCHEMA( + { + "type": "trusted_networks", + "trusted_networks": ["192.168.0.1"], + "trusted_users": { + "192.168.0.1": [ + "a1ab982744b64757bf80515589258924", + {"group": "system-group"}, + ] + }, + } + ) + # Wrong user id format + with pytest.raises(vol.Invalid): + tn_auth.CONFIG_SCHEMA( + { + "type": "trusted_networks", + "trusted_networks": ["192.168.0.1"], + "trusted_users": {"192.168.0.1": ["abcde"]}, + } + ) + + async def test_trusted_networks_credentials(manager, provider) -> None: """Test trusted_networks credentials related functions.""" owner = await manager.async_create_user("test-owner")