block external IP (#17248)

* block external IP

* Update __init__.py
This commit is contained in:
Paulus Schoutsen authored and Paulus Schoutsen committed 2018-10-09 16:20:29 +02:00
1 parent 429f09deb3
commit eb7db1f763
3 files changed
+46 -2

No files matched your search

@@ -1,6 +1,7 @@
"""The tests for the emulated Hue component."""
import asyncio
import json
from ipaddress import ip_address
from unittest.mock import patch
from aiohttp.hdrs import CONTENT_TYPE
@@ -484,3 +485,12 @@ def perform_put_light_state(hass_hue, client, entity_id, is_on,
yield from hass_hue.async_block_till_done()
return result
async def test_external_ip_blocked(hue_client):
"""Test external IP blocked."""
with patch('homeassistant.components.http.real_ip.ip_address',
return_value=ip_address('45.45.45.45')):
result = await hue_client.get('/api/username/lights')
assert result.status == 400