Skip to content

test_util: Implement test for is_gitlab_instance #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest

from pupgui2.util import *

from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS
from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS, GITLAB_API, GITHUB_API
from pupgui2.datastructures import SteamApp, LutrisGame, HeroicGame, Launcher


Expand Down Expand Up @@ -125,3 +127,20 @@ def test_get_random_game_name() -> None:
assert get_random_game_name(steam_app) in names
assert get_random_game_name(lutris_game) in names
assert get_random_game_name(heroic_game) in names


@pytest.mark.parametrize(
'url, is_gitlab_api', [
*[pytest.param(api, True, id = api) for api in GITLAB_API],
pytest.param(GITHUB_API, False, id = GITHUB_API)
]
)
def test_is_gitlab_instance(url: str, is_gitlab_api: bool) -> None:

"""
Test that a given GitLab API URL is detected successfully.
"""

result: bool = is_gitlab_instance(url)

assert result == is_gitlab_api