Skip to content

Commit

Permalink
Added more fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenbos committed Oct 28, 2023
1 parent 84ca39e commit 70ed1bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
8 changes: 8 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""Tests for the Alpa Innotec integration."""

MODULE = "custom_components.alpha_innotec"

VALID_CONFIG = {
"gateway_ip": "127.0.0.1",
"gateway_password": "verysafe",
"controller_ip": "127.0.0.2",
"controller_username": "testing",
"controller_password": "alsoverysafe"
}
Binary file modified tests/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified tests/__pycache__/test_config_flow.cpython-311-pytest-7.3.1.pyc
Binary file not shown.
File renamed without changes.
15 changes: 5 additions & 10 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
import json
from unittest.mock import patch
from homeassistant import config_entries, setup
from homeassistant.core import HomeAssistant

from custom_components.alpha_innotec.const import DOMAIN
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeassistant_custom_component.common import load_fixture

from . import MODULE
from . import MODULE, VALID_CONFIG

VALID_CONFIG = {
"gateway_ip": "127.0.0.1",
"gateway_password": "verysafe",
"controller_ip": "127.0.0.2",
"controller_username": "testing",
"controller_password": "alsoverysafe"
}

async def test_setup_config(hass):
async def test_setup_config(hass: HomeAssistant):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
Expand All @@ -27,7 +22,7 @@ async def test_setup_config(hass):

with patch(
target=f"{MODULE}.config_flow.validate_input",
return_value=json.loads(load_fixture("systeminformation.json")),
return_value=json.loads(load_fixture("controller_api_systeminformation.json")),
) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
Expand Down

1 comment on commit 70ed1bc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.