Add trusted_users in trusted networks auth provider (#22478)
This commit is contained in:
parent
26726af689
commit
6ba2891604
5 changed files with 318 additions and 12 deletions
|
@ -4,6 +4,7 @@ import enum
|
|||
import os
|
||||
from socket import _GLOBAL_DEFAULT_TIMEOUT
|
||||
from unittest.mock import Mock, patch
|
||||
import uuid
|
||||
|
||||
import homeassistant
|
||||
import pytest
|
||||
|
@ -963,3 +964,24 @@ def test_entity_id_allow_old_validation(caplog):
|
|||
assert "Found invalid entity_id {}".format(value) in caplog.text
|
||||
|
||||
assert len(cv.INVALID_ENTITY_IDS_FOUND) == 2
|
||||
|
||||
|
||||
def test_uuid4_hex(caplog):
|
||||
"""Test uuid validation."""
|
||||
schema = vol.Schema(cv.uuid4_hex)
|
||||
|
||||
for value in ['Not a hex string', '0', 0]:
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema(value)
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
# the 13th char should be 4
|
||||
schema('a03d31b22eee1acc9b90eec40be6ed23')
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
# the 17th char should be 8-a
|
||||
schema('a03d31b22eee4acc7b90eec40be6ed23')
|
||||
|
||||
hex = uuid.uuid4().hex
|
||||
assert schema(hex) == hex
|
||||
assert schema(hex.upper()) == hex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue