1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-05-19 14:18:53 +01:00
Files
supervisor/tests/api/test_security.py
T
Stefan Agner f8dbafe0bb Drop redundant @pytest.mark.asyncio decorators (#6795)
The pytest config sets ``asyncio_mode = "auto"``, which already
auto-marks every ``async def test_*`` as a coroutine test. The 38
``@pytest.mark.asyncio`` decorators sprinkled across the suite were
no-ops kept around from before that flag was set. Remove them along
with the now-unused ``import pytest`` lines they were the only
consumer of.

Pure mechanical cleanup; no test behavior changes.
2026-05-04 14:48:18 +02:00

45 lines
1.3 KiB
Python

"""Test Supervisor API."""
from unittest.mock import AsyncMock
from aiohttp.test_utils import TestClient
from supervisor.coresys import CoreSys
async def test_api_security_options_force_security(
api_client_with_prefix: tuple[TestClient, str], coresys: CoreSys
):
"""Test security options force security."""
api_client, prefix = api_client_with_prefix
assert not coresys.security.force
await api_client.post(f"{prefix}/security/options", json={"force_security": True})
assert coresys.security.force
async def test_api_security_options_pwned(
api_client_with_prefix: tuple[TestClient, str], coresys: CoreSys
):
"""Test security options pwned."""
api_client, prefix = api_client_with_prefix
assert coresys.security.pwned
await api_client.post(f"{prefix}/security/options", json={"pwned": False})
assert not coresys.security.pwned
async def test_api_integrity_check(
api_client_with_prefix: tuple[TestClient, str],
coresys: CoreSys,
supervisor_internet: AsyncMock,
):
"""Test security integrity check - now deprecated."""
api_client, prefix = api_client_with_prefix
resp = await api_client.post(f"{prefix}/security/integrity")
# CodeNotary integrity check has been removed, should return 410 Gone
assert resp.status == 410