From: Hans-Christoph Steiner Date: Mon, 25 Sep 2017 14:34:25 +0000 (+0200) Subject: tests: test setting up app git repo like `fdroid build` does X-Git-Tag: 0.9~67 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=eaca20675c45e544f3721d0553bd64ea7e138e29;p=fdroidserver.git tests: test setting up app git repo like `fdroid build` does I wrote this to try to find #379 but this test didn't trigger that bug. --- diff --git a/tests/common.TestCase b/tests/common.TestCase index 7106178d..74fd4eb7 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -12,6 +12,7 @@ import sys import tempfile import unittest import textwrap +import yaml from zipfile import ZipFile @@ -158,6 +159,34 @@ class CommonTest(unittest.TestCase): self.assertIsNotNone(re.search('android:versionName="%s"' % build.versionName, filedata)) self.assertIsNotNone(re.search('android:versionCode="%s"' % build.versionCode, filedata)) + def test_prepare_sources_refresh(self): + packageName = 'org.fdroid.ci.test.app' + testdir = tempfile.mkdtemp(prefix='test_verify_apks', dir=self.tmpdir) + print('testdir', testdir) + os.chdir(testdir) + os.mkdir('build') + os.mkdir('metadata') + + # use a local copy if available to avoid hitting the network + tmprepo = os.path.join(self.basedir, 'tmp', 'importer') + if os.path.exists(tmprepo): + git_url = tmprepo + else: + git_url = 'https://gitlab.com/fdroid/ci-test-app.git' + + metadata = dict() + metadata['Description'] = 'This is just a test app' + metadata['RepoType'] = 'git' + metadata['Repo'] = git_url + with open(os.path.join('metadata', packageName + '.yml'), 'w') as fp: + yaml.dump(metadata, fp) + + gitrepo = os.path.join(testdir, 'build', packageName) + vcs0 = fdroidserver.common.getvcs('git', git_url, gitrepo) + vcs0.gotorevision('0.3', refresh=True) + vcs1 = fdroidserver.common.getvcs('git', git_url, gitrepo) + vcs1.gotorevision('0.3', refresh=False) + def test_fdroid_popen_stderr_redirect(self): config = dict() fdroidserver.common.fill_config_defaults(config)