from tools.check_matrix_agents import build_agent_ws_url


def test_build_agent_ws_url_preserves_path_prefix_without_trailing_slash():
    assert (
        build_agent_ws_url("http://lambda.coredump.ru:7000/agent_17", "41")
        == "http://lambda.coredump.ru:7000/agent_17/v1/agent_ws/41/"
    )


def test_build_agent_ws_url_preserves_path_prefix_with_trailing_slash():
    assert (
        build_agent_ws_url("http://lambda.coredump.ru:7000/agent_17/", "41")
        == "http://lambda.coredump.ru:7000/agent_17/v1/agent_ws/41/"
    )


def test_build_agent_ws_url_accepts_existing_agent_ws_url():
    assert (
        build_agent_ws_url("http://lambda.coredump.ru:7000/agent_17/v1/agent_ws/0/", "41")
        == "http://lambda.coredump.ru:7000/agent_17/v1/agent_ws/41/"
    )
