Don't allow in-memory SQLite database (#69616)

This commit is contained in:
Erik Montnemery 2022-04-08 00:43:09 +02:00 committed by GitHub
parent fab1f29a29
commit 949b0e1b65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 40 deletions

View file

@ -451,15 +451,13 @@ async def test_send_with_no_energy(hass, aioclient_mock):
assert "energy" not in postdata
async def test_send_with_no_energy_config(hass, aioclient_mock):
async def test_send_with_no_energy_config(hass, aioclient_mock, recorder_mock):
"""Test send base preferences are defined."""
aioclient_mock.post(ANALYTICS_ENDPOINT_URL, status=200)
analytics = Analytics(hass)
await analytics.save_preferences({ATTR_BASE: True, ATTR_USAGE: True})
assert await async_setup_component(
hass, "energy", {"recorder": {"db_url": "sqlite://"}}
)
assert await async_setup_component(hass, "energy", {})
with patch("uuid.UUID.hex", new_callable=PropertyMock) as hex, patch(
"homeassistant.components.analytics.analytics.HA_VERSION", MOCK_VERSION
@ -475,15 +473,13 @@ async def test_send_with_no_energy_config(hass, aioclient_mock):
assert not postdata["energy"]["configured"]
async def test_send_with_energy_config(hass, aioclient_mock):
async def test_send_with_energy_config(hass, aioclient_mock, recorder_mock):
"""Test send base preferences are defined."""
aioclient_mock.post(ANALYTICS_ENDPOINT_URL, status=200)
analytics = Analytics(hass)
await analytics.save_preferences({ATTR_BASE: True, ATTR_USAGE: True})
assert await async_setup_component(
hass, "energy", {"recorder": {"db_url": "sqlite://"}}
)
assert await async_setup_component(hass, "energy", {})
with patch("uuid.UUID.hex", new_callable=PropertyMock) as hex, patch(
"homeassistant.components.analytics.analytics.HA_VERSION", MOCK_VERSION