mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-14 21:40:20 +00:00
* Make check_port asyncio This requires to change the ingress_port property to a async method. * Avoid using wait_for * Add missing async * Really await * Set dynamic ingress port on add-on installation/update * Fix pytest issue * Rename async_check_port back to check_port * Raise RuntimeError in case port is not set * Make sure port gets set on add-on restore * Drop unnecessary async * Simplify check_port by using asyncio.get_running_loop()
16 lines
436 B
Python
16 lines
436 B
Python
"""Check ports."""
|
|
from ipaddress import ip_address
|
|
|
|
from supervisor.coresys import CoreSys
|
|
from supervisor.utils import check_port
|
|
|
|
|
|
async def test_exists_open_port(coresys: CoreSys):
|
|
"""Test a exists network port."""
|
|
assert await check_port(ip_address("8.8.8.8"), 53)
|
|
|
|
|
|
async def test_not_exists_port(coresys: CoreSys):
|
|
"""Test a not exists network service."""
|
|
assert not await check_port(ip_address("192.0.2.1"), 53)
|