podman-compose/tests/unit/test_is_path_git_url.py
Povilas Kanapickas dedb081550 tests/unit: Add type annotations
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 17:11:36 +03:00

23 lines
894 B
Python

# SPDX-License-Identifier: GPL-2.0
import unittest
from parameterized import parameterized
from podman_compose import is_path_git_url
class TestIsPathGitUrl(unittest.TestCase):
@parameterized.expand([
("prefix_git", "git://host.xz/path/to/repo", True),
("prefix_almost_git", "gitt://host.xz/path/to/repo", False),
("prefix_wrong", "http://host.xz/path/to/repo", False),
("suffix_git", "http://host.xz/path/to/repo.git", True),
("suffix_wrong", "http://host.xz/path/to/repo", False),
("suffix_with_url_fragment", "http://host.xz/path/to/repo.git#fragment", True),
("suffix_and_prefix", "git://host.xz/path/to/repo.git", True),
("empty_url_path", "http://#fragment", False),
])
def test_is_path_git_url(self, test_name: str, path: str, result: bool) -> None:
self.assertEqual(is_path_git_url(path), result)