nightly: set up test for git clone function

This commit is contained in:
Hans-Christoph Steiner 2024-11-20 16:39:01 +01:00
parent d398994ad3
commit ce018158ee
2 changed files with 33 additions and 6 deletions

View file

@ -192,6 +192,29 @@ class NightlyTest(unittest.TestCase):
with self.assertRaises(exception.VCSException):
nightly.main()
def test_clone_git_repo(self):
os.chdir(self.testdir)
common.options = Options
d = 'fakeappid'
nightly.clone_git_repo('https://gitlab.com/fdroid/ci-test-tiny-repo.git', d)
self.assertTrue(os.path.isdir(Path(d) / '.git'))
def test_clone_git_repo_fails_on_gitlab_password_prompt(self):
os.chdir(self.testdir)
common.options = Options
d = 'shouldnotbecreated'
with self.assertRaises(exception.VCSException):
nightly.clone_git_repo(f'https://gitlab.com/{d}/{d}.git', d)
self.assertFalse(os.path.isdir(Path(d)))
def test_clone_git_repo_fails_on_github_password_prompt(self):
os.chdir(self.testdir)
common.options = Options
d = 'shouldnotbecreated'
with self.assertRaises(exception.VCSException):
nightly.clone_git_repo(f'https://github.com/{d}/{d}.git', d)
self.assertFalse(os.path.isdir(Path(d)))
def _put_fdroid_in_args(self, args):
"""Find fdroid command that belongs to this source code tree"""
fdroid = os.path.join(basedir.parent, 'fdroid')