2023-10-11 14:09:56 +00:00
|
|
|
"""Blebox helpers tests."""
|
|
|
|
|
|
|
|
from aiohttp.helpers import BasicAuth
|
|
|
|
|
|
|
|
from homeassistant.components.blebox.helpers import get_maybe_authenticated_session
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
|
|
|
2024-06-06 10:17:08 +00:00
|
|
|
async def test_get_maybe_authenticated_session_none(hass: HomeAssistant) -> None:
|
2023-10-11 14:09:56 +00:00
|
|
|
"""Tests if session auth is None."""
|
|
|
|
session = get_maybe_authenticated_session(hass=hass, username="", password="")
|
|
|
|
assert session.auth is None
|
|
|
|
|
|
|
|
|
2024-06-06 10:17:08 +00:00
|
|
|
async def test_get_maybe_authenticated_session_auth(hass: HomeAssistant) -> None:
|
2023-10-11 14:09:56 +00:00
|
|
|
"""Tests if session have BasicAuth."""
|
|
|
|
session = get_maybe_authenticated_session(
|
|
|
|
hass=hass, username="user", password="password"
|
|
|
|
)
|
|
|
|
assert isinstance(session.auth, BasicAuth)
|