Remove check if base url is local (#19494)
This commit is contained in:
parent
264d18bc83
commit
ec28ee3c42
2 changed files with 0 additions and 25 deletions
|
@ -1,10 +1,7 @@
|
|||
"""Helpers for data entry flows for config entries."""
|
||||
from functools import partial
|
||||
from ipaddress import ip_address
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.util.network import is_local
|
||||
|
||||
|
||||
def register_discovery_flow(domain, title, discovery_function,
|
||||
|
@ -115,15 +112,6 @@ class WebhookFlowHandler(config_entries.ConfigFlow):
|
|||
if not self._allow_multiple and self._async_current_entries():
|
||||
return self.async_abort(reason='one_instance_allowed')
|
||||
|
||||
try:
|
||||
url_parts = urlparse(self.hass.config.api.base_url)
|
||||
|
||||
if is_local(ip_address(url_parts.hostname)):
|
||||
return self.async_abort(reason='not_internet_accessible')
|
||||
except ValueError:
|
||||
# If it's not an IP address, it's very likely publicly accessible
|
||||
pass
|
||||
|
||||
if user_input is None:
|
||||
return self.async_show_form(
|
||||
step_id='user',
|
||||
|
|
|
@ -183,19 +183,6 @@ async def test_webhook_multiple_entries_allowed(hass, webhook_flow_conf):
|
|||
assert result['type'] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
||||
|
||||
async def test_webhook_config_flow_aborts_external_url(hass,
|
||||
webhook_flow_conf):
|
||||
"""Test configuring a webhook without an external url."""
|
||||
flow = config_entries.HANDLERS['test_single']()
|
||||
flow.hass = hass
|
||||
|
||||
hass.config.api = Mock(base_url='http://192.168.1.10')
|
||||
result = await flow.async_step_user()
|
||||
|
||||
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result['reason'] == 'not_internet_accessible'
|
||||
|
||||
|
||||
async def test_webhook_config_flow_registers_webhook(hass, webhook_flow_conf):
|
||||
"""Test setting up an entry creates a webhook."""
|
||||
flow = config_entries.HANDLERS['test_single']()
|
||||
|
|
Loading…
Add table
Reference in a new issue