podman-compose/tests/unit/test_is_path_git_url.py
Monika Kairaityte 92f0a8583a Fix using git URL as build context
Podman-compose actually did not work with git URL as build context.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-03-30 21:56:55 +03:00

23 lines
870 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, path, result):
self.assertEqual(is_path_git_url(path), result)