mirror of
https://github.com/home-assistant/core.git
synced 2026-09-25 07:51:46 -05:00
Update default timeout to 60s in SMTP integration (#181035)
This commit is contained in:
@@ -26,7 +26,14 @@ from homeassistant.helpers import (
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.ssl import client_context, client_context_no_verify
|
||||
|
||||
from .const import CONF_ENCRYPTION, CONF_ENTRY, CONF_OLD_RECIPIENT, CONF_SERVER, DOMAIN
|
||||
from .const import (
|
||||
CONF_ENCRYPTION,
|
||||
CONF_ENTRY,
|
||||
CONF_OLD_RECIPIENT,
|
||||
CONF_SERVER,
|
||||
DEFAULT_TIMEOUT,
|
||||
DOMAIN,
|
||||
)
|
||||
from .services import async_setup_services
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -71,7 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SmtpConfigEntry) -> bool
|
||||
port=entry.data[CONF_PORT],
|
||||
username=entry.data.get(CONF_USERNAME),
|
||||
password=entry.data.get(CONF_PASSWORD),
|
||||
timeout=entry.options.get(CONF_TIMEOUT),
|
||||
timeout=entry.options.get(CONF_TIMEOUT, DEFAULT_TIMEOUT),
|
||||
use_tls=entry.data[CONF_ENCRYPTION] == "tls",
|
||||
start_tls=entry.data[CONF_ENCRYPTION] == "starttls",
|
||||
tls_context=(
|
||||
|
||||
@@ -65,7 +65,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
OPTIONS_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): vol.All(
|
||||
vol.Optional(CONF_TIMEOUT): vol.All(
|
||||
NumberSelector(
|
||||
NumberSelectorConfig(
|
||||
min=1,
|
||||
@@ -309,7 +309,7 @@ async def validate_input(
|
||||
port=user_input[CONF_PORT],
|
||||
username=user_input.get(CONF_USERNAME),
|
||||
password=user_input.get(CONF_PASSWORD),
|
||||
timeout=options.get(CONF_TIMEOUT),
|
||||
timeout=options.get(CONF_TIMEOUT, DEFAULT_TIMEOUT),
|
||||
use_tls=user_input[CONF_ENCRYPTION] == "tls",
|
||||
start_tls=user_input[CONF_ENCRYPTION] == "starttls",
|
||||
tls_context=(
|
||||
|
||||
@@ -20,7 +20,7 @@ SECTION_OPTIONS: Final = "options"
|
||||
|
||||
DEFAULT_HOST: Final = "localhost"
|
||||
DEFAULT_PORT: Final = 587
|
||||
DEFAULT_TIMEOUT: Final = 5
|
||||
DEFAULT_TIMEOUT: Final = 60
|
||||
DEFAULT_DEBUG: Final = False
|
||||
DEFAULT_ENCRYPTION: Final = "starttls"
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
"timeout": "Connection timeout"
|
||||
},
|
||||
"data_description": {
|
||||
"timeout": "Maximum time to wait for a response from the SMTP server before the connection attempt is aborted."
|
||||
"timeout": "Maximum time to wait for a response from the SMTP server before the connection attempt is aborted. Defaults to 60 seconds."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ async def test_form(
|
||||
result["flow_id"],
|
||||
{
|
||||
**USER_INPUT,
|
||||
SECTION_OPTIONS: {CONF_TIMEOUT: 60},
|
||||
SECTION_OPTIONS: {},
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@@ -61,7 +61,7 @@ async def test_form(
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "Home Assistant"
|
||||
assert result["data"] == USER_INPUT
|
||||
assert result["options"] == {CONF_TIMEOUT: 60}
|
||||
assert result["options"] == {}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
Reference in New Issue
Block a user