Exemple #1
0
def test__get_connection_uri__http_auth(mocker):
    """
    Test "_get_connection_uri" method must return connection string for
    http with authorization.

    :param mocker: mock
    :type mocker: MockerFixture
    """

    mocker.patch(
        "sys.argv",
        [
            "check_supervisord.py",
            "-s",
            "127.0.0.1",
            "-p",
            "9001",
            "-u",
            "supervisord",
            "-S",
            "password",
        ],
    )

    checker = CheckSupervisord()

    assert (  # nosec: B101
        checker._get_connection_uri(tpl=checker.URI_TPL_HTTP_AUTH) ==
        "http://*****:*****@127.0.0.1:9001")
Exemple #2
0
def test__get_connection_uri__http(mocker):
    """
    Test "_get_connection_uri" method must return connection string for http.

    :param mocker: mock
    :type mocker: MockerFixture
    """

    mocker.patch(
        "sys.argv",
        ["check_supervisord.py", "-s", "127.0.0.1", "-p", "9001"],
    )

    checker = CheckSupervisord()

    assert (  # nosec: B101
        checker._get_connection_uri(
            tpl=checker.URI_TPL_HTTP) == "http://127.0.0.1:9001")
Exemple #3
0
def test__get_connection_uri__socket(mocker):
    """
    Test "_get_connection_uri" method must return connection string for socket.

    :param mocker: mock
    :type mocker: MockerFixture
    """

    mocker.patch(
        "sys.argv",
        ["check_supervisord.py", "-s", "/tmp/supervisord.sock"],  # nosec: B108
    )

    checker = CheckSupervisord()

    assert (  # nosec: B101
        checker._get_connection_uri(
            tpl=checker.URI_TPL_SOCKET) == "unix:///tmp/supervisord.sock")