1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 02:18:59 +00:00
Files
supervisor/tests/utils/test_log_format.py
2025-03-01 15:52:29 +00:00

28 lines
868 B
Python

"""Tests for message formater."""
from supervisor.utils.log_format import async_format_message
def test_format_message_port():
"""Tests for message formater."""
message = '500 Server Error: Internal Server Error: Bind for 0.0.0.0:80 failed: port is already allocated")'
assert (
async_format_message(message)
== "Port '80' is already in use by something else on the host."
)
def test_format_message_port_alternative():
"""Tests for message formater."""
message = 'Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use")'
assert (
async_format_message(message)
== "Port '80' is already in use by something else on the host."
)
async def test_exeption():
"""Tests the exception handling."""
message = b"byte"
assert async_format_message(message) == message