mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-10 03:19:37 +00:00
* Enable IPv6 by default for new installations Enable IPv6 by default for new Supervisor installations. Let's also make the `enable_ipv6` attribute nullable, so we can distinguish between "not set" and "set to false". * Add pytest * Add log message that system restart is required for IPv6 changes * Fix API pytest * Create resolution center issue when reboot is required * Order log after actual setter call
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Test Docker API."""
|
|
|
|
from aiohttp.test_utils import TestClient
|
|
import pytest
|
|
|
|
from supervisor.coresys import CoreSys
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_api_docker_info(api_client: TestClient):
|
|
"""Test docker info api."""
|
|
resp = await api_client.get("/docker/info")
|
|
result = await resp.json()
|
|
|
|
assert result["data"]["logging"] == "journald"
|
|
assert result["data"]["storage"] == "overlay2"
|
|
assert result["data"]["version"] == "1.0.0"
|
|
|
|
|
|
async def test_api_network_enable_ipv6(coresys: CoreSys, api_client: TestClient):
|
|
"""Test setting docker network for enabled IPv6."""
|
|
assert coresys.docker.config.enable_ipv6 is None
|
|
|
|
resp = await api_client.post("/docker/options", json={"enable_ipv6": True})
|
|
assert resp.status == 200
|
|
|
|
assert coresys.docker.config.enable_ipv6 is True
|
|
|
|
resp = await api_client.get("/docker/info")
|
|
assert resp.status == 200
|
|
body = await resp.json()
|
|
assert body["data"]["enable_ipv6"] is True
|
|
|
|
|
|
async def test_registry_not_found(api_client: TestClient):
|
|
"""Test registry not found error."""
|
|
resp = await api_client.delete("/docker/registries/bad")
|
|
assert resp.status == 404
|
|
body = await resp.json()
|
|
assert body["message"] == "Hostname bad does not exist in registries"
|