Use proper signals (#18613)
* Emulated Hue not use deprecated handler * Remove no longer needed workaround * Add middleware directly * Dont always load the ban config file * Update homeassistant/components/http/ban.py Co-Authored-By: balloob <paulus@home-assistant.io> * Update __init__.py
This commit is contained in:
parent
5b3e9399a9
commit
1341ecd2eb
7 changed files with 43 additions and 45 deletions
|
@ -16,6 +16,9 @@ from homeassistant.components.http.ban import (
|
|||
|
||||
from . import mock_real_ip
|
||||
|
||||
from tests.common import mock_coro
|
||||
|
||||
|
||||
BANNED_IPS = ['200.201.202.203', '100.64.0.2']
|
||||
|
||||
|
||||
|
@ -25,9 +28,9 @@ async def test_access_from_banned_ip(hass, aiohttp_client):
|
|||
setup_bans(hass, app, 5)
|
||||
set_real_ip = mock_real_ip(app)
|
||||
|
||||
with patch('homeassistant.components.http.ban.load_ip_bans_config',
|
||||
return_value=[IpBan(banned_ip) for banned_ip
|
||||
in BANNED_IPS]):
|
||||
with patch('homeassistant.components.http.ban.async_load_ip_bans_config',
|
||||
return_value=mock_coro([IpBan(banned_ip) for banned_ip
|
||||
in BANNED_IPS])):
|
||||
client = await aiohttp_client(app)
|
||||
|
||||
for remote_addr in BANNED_IPS:
|
||||
|
@ -71,9 +74,9 @@ async def test_ip_bans_file_creation(hass, aiohttp_client):
|
|||
setup_bans(hass, app, 1)
|
||||
mock_real_ip(app)("200.201.202.204")
|
||||
|
||||
with patch('homeassistant.components.http.ban.load_ip_bans_config',
|
||||
return_value=[IpBan(banned_ip) for banned_ip
|
||||
in BANNED_IPS]):
|
||||
with patch('homeassistant.components.http.ban.async_load_ip_bans_config',
|
||||
return_value=mock_coro([IpBan(banned_ip) for banned_ip
|
||||
in BANNED_IPS])):
|
||||
client = await aiohttp_client(app)
|
||||
|
||||
m = mock_open()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue