Bump wallbox to 0.4.9 (#72978)

This commit is contained in:
hesselonline 2022-06-06 03:31:09 +02:00 committed by GitHub
parent 7f0091280f
commit 9ea504dd7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 61 additions and 128 deletions

View File

@ -3,7 +3,7 @@
"name": "Wallbox",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/wallbox",
"requirements": ["wallbox==0.4.4"],
"requirements": ["wallbox==0.4.9"],
"ssdp": [],
"zeroconf": [],
"homekit": {},

View File

@ -2418,7 +2418,7 @@ vultr==0.1.2
wakeonlan==2.0.1
# homeassistant.components.wallbox
wallbox==0.4.4
wallbox==0.4.9
# homeassistant.components.waqi
waqiasync==1.0.0

View File

@ -1597,7 +1597,7 @@ vultr==0.1.2
wakeonlan==2.0.1
# homeassistant.components.wallbox
wallbox==0.4.4
wallbox==0.4.9
# homeassistant.components.folder_watcher
watchdog==2.1.8

View File

@ -26,7 +26,7 @@ from homeassistant.components.wallbox.const import (
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from .const import ERROR, JWT, STATUS, TTL, USER_ID
from .const import ERROR, STATUS, TTL, USER_ID
from tests.common import MockConfigEntry
@ -54,11 +54,32 @@ test_response = json.loads(
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
"data": {
"attributes": {
"token": "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
}
}
)
)
authorisation_response_unauthorised = json.loads(
json.dumps(
{
"data": {
"attributes": {
"token": "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 404,
}
}
}
)
)
@ -81,7 +102,7 @@ async def setup_integration(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=HTTPStatus.OK,
)
@ -107,7 +128,7 @@ async def setup_integration_connection_error(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=HTTPStatus.FORBIDDEN,
)
@ -133,7 +154,7 @@ async def setup_integration_read_only(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=HTTPStatus.OK,
)

View File

@ -18,8 +18,12 @@ from homeassistant.components.wallbox.const import (
)
from homeassistant.core import HomeAssistant
from tests.components.wallbox import entry, setup_integration
from tests.components.wallbox.const import ERROR, JWT, STATUS, TTL, USER_ID
from tests.components.wallbox import (
authorisation_response,
authorisation_response_unauthorised,
entry,
setup_integration,
)
test_response = json.loads(
json.dumps(
@ -34,30 +38,6 @@ test_response = json.loads(
)
)
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
)
)
authorisation_response_unauthorised = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 404,
}
)
)
async def test_show_set_form(hass: HomeAssistant) -> None:
"""Test that the setup form is served."""
@ -77,7 +57,7 @@ async def test_form_cannot_authenticate(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=HTTPStatus.FORBIDDEN,
)
@ -107,7 +87,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response_unauthorised,
status_code=HTTPStatus.NOT_FOUND,
)
@ -137,7 +117,7 @@ async def test_form_validate_input(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=HTTPStatus.OK,
)
@ -166,8 +146,8 @@ async def test_form_reauth(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
text='{"jwt":"fakekeyhere","user_id":12345,"ttl":145656758,"error":false,"status":200}',
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)
mock_request.get(
@ -206,7 +186,7 @@ async def test_form_reauth_invalid(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
text='{"jwt":"fakekeyhere","user_id":12345,"ttl":145656758,"error":false,"status":200}',
status_code=200,
)

View File

@ -11,24 +11,12 @@ from . import test_response
from tests.components.wallbox import (
DOMAIN,
authorisation_response,
entry,
setup_integration,
setup_integration_connection_error,
setup_integration_read_only,
)
from tests.components.wallbox.const import ERROR, JWT, STATUS, TTL, USER_ID
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
)
)
async def test_wallbox_setup_unload_entry(hass: HomeAssistant) -> None:
@ -59,7 +47,7 @@ async def test_wallbox_refresh_failed_invalid_auth(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=403,
)
@ -85,7 +73,7 @@ async def test_wallbox_refresh_failed_connection_error(hass: HomeAssistant) -> N
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)

View File

@ -10,30 +10,12 @@ from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from tests.components.wallbox import (
authorisation_response,
entry,
setup_integration,
setup_integration_read_only,
)
from tests.components.wallbox.const import (
ERROR,
JWT,
MOCK_LOCK_ENTITY_ID,
STATUS,
TTL,
USER_ID,
)
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
)
)
from tests.components.wallbox.const import MOCK_LOCK_ENTITY_ID
async def test_wallbox_lock_class(hass: HomeAssistant) -> None:
@ -47,7 +29,7 @@ async def test_wallbox_lock_class(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)
@ -85,7 +67,7 @@ async def test_wallbox_lock_class_connection_error(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)

View File

@ -9,27 +9,8 @@ from homeassistant.components.wallbox import CHARGER_MAX_CHARGING_CURRENT_KEY
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from tests.components.wallbox import entry, setup_integration
from tests.components.wallbox.const import (
ERROR,
JWT,
MOCK_NUMBER_ENTITY_ID,
STATUS,
TTL,
USER_ID,
)
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
)
)
from tests.components.wallbox import authorisation_response, entry, setup_integration
from tests.components.wallbox.const import MOCK_NUMBER_ENTITY_ID
async def test_wallbox_number_class(hass: HomeAssistant) -> None:
@ -39,7 +20,7 @@ async def test_wallbox_number_class(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)
@ -68,7 +49,7 @@ async def test_wallbox_number_class_connection_error(hass: HomeAssistant) -> Non
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)

View File

@ -10,27 +10,8 @@ from homeassistant.components.wallbox.const import CHARGER_STATUS_ID_KEY
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from tests.components.wallbox import entry, setup_integration
from tests.components.wallbox.const import (
ERROR,
JWT,
MOCK_SWITCH_ENTITY_ID,
STATUS,
TTL,
USER_ID,
)
authorisation_response = json.loads(
json.dumps(
{
JWT: "fakekeyhere",
USER_ID: 12345,
TTL: 145656758,
ERROR: "false",
STATUS: 200,
}
)
)
from tests.components.wallbox import authorisation_response, entry, setup_integration
from tests.components.wallbox.const import MOCK_SWITCH_ENTITY_ID
async def test_wallbox_switch_class(hass: HomeAssistant) -> None:
@ -44,7 +25,7 @@ async def test_wallbox_switch_class(hass: HomeAssistant) -> None:
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)
@ -82,7 +63,7 @@ async def test_wallbox_switch_class_connection_error(hass: HomeAssistant) -> Non
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)
@ -121,7 +102,7 @@ async def test_wallbox_switch_class_authentication_error(hass: HomeAssistant) ->
with requests_mock.Mocker() as mock_request:
mock_request.get(
"https://api.wall-box.com/auth/token/user",
"https://user-api.wall-box.com/users/signin",
json=authorisation_response,
status_code=200,
)