"""Server list status field derived from is_online + agent_version."""
from server.api.servers import _derive_server_status


def test_online_with_agent():
    assert _derive_server_status(True, "2.0.0") == "online"


def test_offline_with_agent():
    assert _derive_server_status(False, "2.0.0") == "offline"


def test_unknown_without_agent():
    assert _derive_server_status(False, None) == "unknown"
    assert _derive_server_status(False, "") == "unknown"


def test_offline_with_agent_key_only():
    assert _derive_server_status(False, None, has_agent=True) == "offline"
