Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DamKast committed Nov 7, 2024
1 parent 8a5e322 commit 8db4d46
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,17 @@ def __repr__(self):
return f"<{type(self).__name__} to {self.protocol}>"


def config_for_port_path(path):
def config_for_port_path(path, apply_schema: bool = True):
"""Port path configuration."""
return conf.CONFIG_SCHEMA(
{
conf.CONF_DEVICE: {conf.CONF_DEVICE_PATH: path},
conf.CONF_DEVICE_BAUDRATE: 115200,
conf.CONF_DEVICE_FLOW_CONTROL: None
}
)
config = {
conf.CONF_DEVICE: {conf.CONF_DEVICE_PATH: path},
zigpy.config.CONF_NWK_BACKUP_ENABLED: False,
}

if apply_schema:
return conf.CONFIG_SCHEMA(config)

return config


@pytest.fixture
Expand Down Expand Up @@ -389,10 +391,14 @@ def inner(
active_sequence=False,
**kwargs,
):
default = config_for_port_path(FAKE_SERIAL_PORT)

client_config = merge_dicts(default, client_config or {})
server_config = merge_dicts(default, server_config or {})
client_config = merge_dicts(
config_for_port_path(FAKE_SERIAL_PORT, apply_schema=False),
client_config or {},
)
server_config = merge_dicts(
config_for_port_path(FAKE_SERIAL_PORT),
server_config or {},
)

app = ControllerApplication(client_config)

Expand Down

0 comments on commit 8db4d46

Please sign in to comment.