Add platform only config schema to nsw_fuel_station and ping (#93913)

This commit is contained in:
Erik Montnemery 2023-06-01 17:30:15 +02:00 committed by GitHub
parent e33ae72f95
commit f9037d5f6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 8 deletions

View file

@ -1552,3 +1552,28 @@ def test_config_entry_only_schema_no_hass(
assert expected_message in caplog.text
issue_registry = ir.async_get(hass)
assert not issue_registry.issues
def test_platform_only_schema(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test config_entry_only_config_schema."""
expected_issue = "platform_only_test_domain"
expected_message = (
"The test_domain integration does not support YAML setup, please remove "
"it from your configuration"
)
issue_registry = ir.async_get(hass)
cv.platform_only_config_schema("test_domain")({})
assert expected_message not in caplog.text
assert not issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, expected_issue)
cv.platform_only_config_schema("test_domain")({"test_domain": {}})
assert expected_message in caplog.text
assert issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, expected_issue)
issue_registry.async_delete(HOMEASSISTANT_DOMAIN, expected_issue)
cv.platform_only_config_schema("test_domain")({"test_domain": {"foo": "bar"}})
assert expected_message in caplog.text
assert issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, expected_issue)