Refactor wallbox tests (#51094)
* Changed Testing, removed custom exception Removed custom exceptions, reverted to builtin. Changed testing approach in all tests, now using the core interface to setup device and mock_requests to create test responses for all calls. * Reintroduce InvalidAuth exception in __init__ Remove reference to internal HA exception, Reintroduce custom exception * Removed duplicate entry in test_config_flow * removed tests from test_init that calling methods directly * Update tests/components/wallbox/__init__.py Removed duplicate add_to_hass call Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
2d1744c573
commit
e56069558a
6 changed files with 137 additions and 270 deletions
|
@ -4,7 +4,7 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries, core
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from . import CannotConnect, InvalidAuth, WallboxHub
|
||||
from . import InvalidAuth, WallboxHub
|
||||
from .const import CONF_STATION, DOMAIN
|
||||
|
||||
COMPONENT_DOMAIN = DOMAIN
|
||||
|
@ -46,7 +46,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=COMPONENT_DOMAIN):
|
|||
|
||||
try:
|
||||
info = await validate_input(self.hass, user_input)
|
||||
except CannotConnect:
|
||||
except ConnectionError:
|
||||
errors["base"] = "cannot_connect"
|
||||
except InvalidAuth:
|
||||
errors["base"] = "invalid_auth"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue