1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
"""Tests for ha.io/version.json."""
from unittest.mock import patch
import aiohttp
import pytest
from pyhaversion import HaVersion
from pyhaversion.consts import HaVersionSource
from .const import STABLE_VERSION
@pytest.mark.asyncio
async def test_local():
"""Test ha.io/version.json stable."""
async with aiohttp.ClientSession() as session:
haversion = HaVersion(session=session, source=HaVersionSource.LOCAL)
await haversion.get_version()
assert haversion.version is None
with patch("pyhaversion.local.localversion", STABLE_VERSION):
async with aiohttp.ClientSession() as session:
haversion = HaVersion(session=session, source=HaVersionSource.LOCAL)
await haversion.get_version()
assert haversion.version == STABLE_VERSION
|