Do not ban supervisor ip if set (#33781)
* Use asynctest patch instead of mock_coro * Add test for supervisor ip ban * Do not ban supervisor ip if set * Extract supervisor ip helper * Check supervisor ip before banning * Remove added blank line * Clean up get supervisor ip Co-Authored-By: Pascal Vizeli <pvizeli@syshack.ch> Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
parent
8d61893c39
commit
c3decc6531
4 changed files with 82 additions and 16 deletions
|
@ -1,16 +1,12 @@
|
|||
"""Fixtures for component testing."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from asynctest import patch
|
||||
import pytest
|
||||
|
||||
from tests.common import mock_coro
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def prevent_io():
|
||||
"""Fixture to prevent certain I/O from happening."""
|
||||
with patch(
|
||||
"homeassistant.components.http.ban.async_load_ip_bans_config",
|
||||
side_effect=lambda *args: mock_coro([]),
|
||||
"homeassistant.components.http.ban.async_load_ip_bans_config", return_value=[],
|
||||
):
|
||||
yield
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue