[util] Resolve git+https URLs

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-16 07:51:13 +02:00
parent 4e3d87e658
commit d3900296af
2 changed files with 14 additions and 1 deletions

View file

@ -68,6 +68,15 @@ class TestGitRefResolver(unittest.TestCase):
run.assert_called_once_with(['git', 'ls-remote', 'https://git.example.com/repo.git', 'HEAD'])
self.assertEqual(url, 'https://git.example.com/repo.git?#CAFEBABE')
@mock.patch('pungi.util.run')
def test_resolve_strip_git_plus_prefix(self, run):
run.return_value = (0, 'CAFEBABE\tHEAD\n')
url = util.resolve_git_url('git+https://git.example.com/repo.git#HEAD')
run.assert_called_once_with(['git', 'ls-remote', 'https://git.example.com/repo.git', 'HEAD'])
self.assertEqual(url, 'git+https://git.example.com/repo.git#CAFEBABE')
class TestGetVariantData(unittest.TestCase):
def test_get_simple(self):