Add check for pwned secrets to resolution center (#2614)

* Add check for pwned secrets to resolution center

* restructure check

* add checks

* Add test

* Add test

* reload secrets before check

* simplify

* create notification

* Use own exceptions

* Check on startup

* Apply suggestions from code review

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Add job decorator

* Update supervisor/resolution/notify.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Update supervisor/utils/pwned.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Pascal Vizeli
2021-02-25 09:37:45 +01:00
committed by GitHub
parent dd561da819
commit 85d527bfbc
15 changed files with 306 additions and 21 deletions

View File

@@ -166,6 +166,22 @@ def test_simple_device_schema(coresys):
)({"name": "Pascal", "password": "1234", "input": "/dev/video1"})
def test_simple_schema_password(coresys):
"""Test with simple schema password pwned."""
validate = AddonOptions(
coresys,
{"name": "str", "password": "password", "fires": "bool", "alias": "str?"},
MOCK_ADDON_NAME,
MOCK_ADDON_SLUG,
)
assert validate(
{"name": "Pascal", "password": "1234", "fires": True, "alias": "test"}
)
assert validate.pwned == {"7110eda4d09e062aa5e4a390b0a572ac0d2c0220"}
def test_ui_simple_schema(coresys):
"""Test with simple schema."""
assert UiOptions(coresys)(