1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Add throttle to job execution (#2631)

* Add throttle to job execution

* fix unittests

* Add tests

* address comments

* add comment

* better on __init__

* New text

* Simplify logic
This commit is contained in:
Pascal Vizeli
2021-02-25 23:29:03 +01:00
committed by GitHub
parent 78d9c60be5
commit 31f5033dca
9 changed files with 123 additions and 80 deletions

View File

@@ -30,7 +30,7 @@ async def test_check(coresys: CoreSys):
"supervisor.resolution.checks.addon_pwned.check_pwned_password",
AsyncMock(return_value=True),
) as mock:
await addon_pwned.run_check()
await addon_pwned.run_check.__wrapped__(addon_pwned)
assert not mock.called
addon.pwned.add("123456")
@@ -38,7 +38,7 @@ async def test_check(coresys: CoreSys):
"supervisor.resolution.checks.addon_pwned.check_pwned_password",
AsyncMock(return_value=False),
) as mock:
await addon_pwned.run_check()
await addon_pwned.run_check.__wrapped__(addon_pwned)
assert mock.called
assert len(coresys.resolution.issues) == 0
@@ -47,7 +47,7 @@ async def test_check(coresys: CoreSys):
"supervisor.resolution.checks.addon_pwned.check_pwned_password",
AsyncMock(return_value=True),
) as mock:
await addon_pwned.run_check()
await addon_pwned.run_check.__wrapped__(addon_pwned)
assert mock.called
assert len(coresys.resolution.issues) == 1