mirror of https://github.com/home-assistant/core
25 lines
743 B
Python
25 lines
743 B
Python
"""Test the sql utils."""
|
|
|
|
from homeassistant.components.recorder import Recorder, get_instance
|
|
from homeassistant.components.sql.util import resolve_db_url
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
async def test_resolve_db_url_when_none_configured(
|
|
recorder_mock: Recorder,
|
|
hass: HomeAssistant,
|
|
) -> None:
|
|
"""Test return recorder db_url if provided db_url is None."""
|
|
db_url = None
|
|
resolved_url = resolve_db_url(hass, db_url)
|
|
|
|
assert resolved_url == get_instance(hass).db_url
|
|
|
|
|
|
async def test_resolve_db_url_when_configured(hass: HomeAssistant) -> None:
|
|
"""Test return provided db_url if it's set."""
|
|
db_url = "mssql://"
|
|
resolved_url = resolve_db_url(hass, db_url)
|
|
|
|
assert resolved_url == db_url
|