Add test for git getref

This commit is contained in:
Jochen Sprickerhof 2022-09-15 13:32:11 +02:00
parent 603c8c5cd4
commit f96f247095
No known key found for this signature in database
GPG Key ID: 5BFFDCC258E69433
1 changed files with 17 additions and 0 deletions

View File

@ -2382,6 +2382,23 @@ class CommonTest(unittest.TestCase):
vcs = fdroidserver.common.vcs_git(None, Path.cwd())
self.assertEqual(vcs.latesttags(), tags[::-1])
def test_vcs_git_getref(self):
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
# TODO: Python3.6: Should accept path-like
repo = git.Repo.init(str(Path.cwd()))
tag = "1.1.1"
f = Path("test")
f.write_text(tag)
repo.index.add([str(f)])
repo.index.commit("foo")
repo.create_tag(tag)
vcs = fdroidserver.common.vcs_git(None, Path.cwd())
self.assertIsNotNone(vcs.getref("1.1.1"))
self.assertIsNone(vcs.getref("invalid"))
def test_get_release_filename(self):
app = fdroidserver.metadata.App()
app.id = 'test.app'