* Add elmax integration. * Run hassfest and generate requirements_all * Remove secondary platforms from elmax integration as per first component integration. * Move ElmaxCoordinator and ElmaxEntity into external file Linting review * Remove useless variables * Fix wrong indentation. * Remove unecessary platforms. * Remove unnecessary attributes from manifest. * Rely on property getters/setters rathern than private attribute from parent. Update internal entity state just after transitory state update. * Update homeassistant/components/elmax/const.py Reference Platform constant Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de> * Update username/password values Rely on already-present templating constants Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de> * Add missing constant import. * Remove unnecessary test_unhandled_error() callback implementation. * Add common.py to coverage ignore list. * Improve coverage of config_flow. * Rename the integration. Co-authored-by: Franck Nijhof <frenck@frenck.nl> * Fix reauth bug and improve testing. * Refactor lambdas into generators. Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""Configuration for Elmax tests."""
|
|
import json
|
|
|
|
from elmax_api.constants import (
|
|
BASE_URL,
|
|
ENDPOINT_DEVICES,
|
|
ENDPOINT_DISCOVERY,
|
|
ENDPOINT_LOGIN,
|
|
)
|
|
from httpx import Response
|
|
import pytest
|
|
import respx
|
|
|
|
from tests.common import load_fixture
|
|
from tests.components.elmax import MOCK_PANEL_ID, MOCK_PANEL_PIN
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def httpx_mock_fixture(requests_mock):
|
|
"""Configure httpx fixture."""
|
|
with respx.mock(base_url=BASE_URL, assert_all_called=False) as respx_mock:
|
|
# Mock Login POST.
|
|
login_route = respx_mock.post(f"/{ENDPOINT_LOGIN}", name="login")
|
|
login_route.return_value = Response(
|
|
200, json=json.loads(load_fixture("login.json", "elmax"))
|
|
)
|
|
|
|
# Mock Device list GET.
|
|
list_devices_route = respx_mock.get(f"/{ENDPOINT_DEVICES}", name="list_devices")
|
|
list_devices_route.return_value = Response(
|
|
200, json=json.loads(load_fixture("list_devices.json", "elmax"))
|
|
)
|
|
|
|
# Mock Panel GET.
|
|
get_panel_route = respx_mock.get(
|
|
f"/{ENDPOINT_DISCOVERY}/{MOCK_PANEL_ID}/{MOCK_PANEL_PIN}", name="get_panel"
|
|
)
|
|
get_panel_route.return_value = Response(
|
|
200, json=json.loads(load_fixture("get_panel.json", "elmax"))
|
|
)
|
|
|
|
yield respx_mock
|