Mqtt prepare test base part1 (#89796)
* Refactor test_reloadable * Refactor test_disabling_and_enabling_entry * optimize test_unload_config_entry * Cleanup help_test_unload_config_entry * cleanup test_unload_entry * Update test tls_version * More tests to entry only * Add validate and hassconfig patch * Revert fixture changes patch_hass_config * Follow up comments
This commit is contained in:
parent
886c2635ad
commit
c81a38effb
28 changed files with 389 additions and 516 deletions
|
@ -1,6 +1,5 @@
|
|||
"""The tests for mqtt update component."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
@ -43,7 +42,7 @@ from .test_common import (
|
|||
)
|
||||
|
||||
from tests.common import async_fire_mqtt_message
|
||||
from tests.typing import MqttMockHAClientGenerator
|
||||
from tests.typing import MqttMockHAClientGenerator, MqttMockPahoClient
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
mqtt.DOMAIN: {
|
||||
|
@ -678,26 +677,21 @@ async def test_setup_manual_entity_from_yaml(hass: HomeAssistant) -> None:
|
|||
|
||||
async def test_unload_entry(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator,
|
||||
tmp_path: Path,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
) -> None:
|
||||
"""Test unloading the config entry."""
|
||||
domain = update.DOMAIN
|
||||
config = DEFAULT_CONFIG
|
||||
await help_test_unload_config_entry_with_platform(
|
||||
hass, mqtt_mock_entry_with_yaml_config, tmp_path, domain, config
|
||||
hass, mqtt_mock_entry_no_yaml_config, domain, config
|
||||
)
|
||||
|
||||
|
||||
async def test_reloadable(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
tmp_path: Path,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
) -> None:
|
||||
"""Test reloading the MQTT platform."""
|
||||
domain = update.DOMAIN
|
||||
config = DEFAULT_CONFIG
|
||||
await help_test_reloadable(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog, tmp_path, domain, config
|
||||
)
|
||||
await help_test_reloadable(hass, mqtt_client_mock, domain, config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue