import pytest

from prefect_firebolt import FireboltCredentials


@pytest.mark.parametrize(
    "username,password,token,error_message",
    [
        ("me@example.com", "hunter2", None, None),
        (
            "me@example.com",
            None,
            None,
            "You have provided only a username or password.",
        ),
        (None, "hunter2", None, "You have provided only a username or password."),
        (
            None,
            "hunter2",
            "abc123",
            "You have provided both a username/password and a token.",
        ),
        (None, None, "abc123", None),
        (None, None, None, "You have not provided a username/password or token."),
    ],
)
def test_validate_auth_parameter_combinations(username, password, token, error_message):
    if error_message:
        with pytest.raises(ValueError, match=error_message):
            FireboltCredentials(username=username, password=password, token=token)
    else:
        FireboltCredentials(username=username, password=password, token=token)
