Default to recorder db for SQL integration (#85436)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
G Johansson 2023-03-14 04:41:32 +01:00 committed by GitHub
parent 2f4e9c8ef3
commit afa58b80bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 120 additions and 54 deletions

View file

@ -182,6 +182,7 @@ async def test_invalid_url_setup(
async def test_invalid_url_on_update(
recorder_mock: Recorder,
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
) -> None:
@ -192,22 +193,9 @@ async def test_invalid_url_on_update(
"column": "value",
"name": "count_tables",
}
entry = MockConfigEntry(
domain=DOMAIN,
source=SOURCE_USER,
data={},
options=config,
entry_id="1",
)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
await init_integration(hass, config)
with patch(
"homeassistant.components.recorder",
), patch(
"homeassistant.components.sql.sensor.sqlalchemy.engine.cursor.CursorResult",
side_effect=SQLAlchemyError(
"sqlite://homeassistant:hunter2@homeassistant.local"
@ -219,7 +207,6 @@ async def test_invalid_url_on_update(
)
await hass.async_block_till_done()
assert "sqlite://homeassistant:hunter2@homeassistant.local" not in caplog.text
assert "sqlite://****:****@homeassistant.local" in caplog.text