File: test_local.py

package info (click to toggle)
pyhaversion 24.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 388 kB
  • sloc: python: 962; sh: 12; makefile: 6
file content (26 lines) | stat: -rw-r--r-- 812 bytes parent folder | download
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