Skip to content

Commit 82321e7

Browse files
authored
test_util: Implement test for is_gitlab_instance (#530)
1 parent 6065e06 commit 82321e7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/test_util.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import pytest
2+
13
from pupgui2.util import *
24

3-
from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS
5+
from pupgui2.constants import POSSIBLE_INSTALL_LOCATIONS, GITLAB_API, GITHUB_API
46
from pupgui2.datastructures import SteamApp, LutrisGame, HeroicGame, Launcher
57

68

@@ -125,3 +127,20 @@ def test_get_random_game_name() -> None:
125127
assert get_random_game_name(steam_app) in names
126128
assert get_random_game_name(lutris_game) in names
127129
assert get_random_game_name(heroic_game) in names
130+
131+
132+
@pytest.mark.parametrize(
133+
'url, is_gitlab_api', [
134+
*[pytest.param(api, True, id = api) for api in GITLAB_API],
135+
pytest.param(GITHUB_API, False, id = GITHUB_API)
136+
]
137+
)
138+
def test_is_gitlab_instance(url: str, is_gitlab_api: bool) -> None:
139+
140+
"""
141+
Test that a given GitLab API URL is detected successfully.
142+
"""
143+
144+
result: bool = is_gitlab_instance(url)
145+
146+
assert result == is_gitlab_api

0 commit comments

Comments
 (0)