Commit 0b4112f7 authored by Hans-Christoph Steiner's avatar Hans-Christoph Steiner
Browse files

Merge branch 'scanner-safe_path_test' into 'master'

scanner: add test with abs/rel paths as run from `fdroid build`

See merge request !768
parents 8d517d45 2c4e9bea
Pipeline #157106837 passed with stage
in 21 minutes and 52 seconds
......@@ -105,9 +105,17 @@ class ScannerTest(unittest.TestCase):
self.assertEqual(2, count, 'there should be this many errors')
def test_scan_source_file_types(self):
"""Build product files are not allowed, test they are detected"""
"""Build product files are not allowed, test they are detected
This test runs as if `fdroid build` running to test the
difference between absolute and relative paths.
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
build_dir = os.path.join('build', '')
abs_build_dir = os.path.join(testdir, build_dir)
os.makedirs(abs_build_dir, exist_ok=True)
fdroidserver.scanner.config = None
fdroidserver.scanner.options = mock.Mock()
......@@ -151,8 +159,11 @@ class ScannerTest(unittest.TestCase):
os.chmod('snippet.png', 0o755)
os.system('ls -l fake.png')
count = fdroidserver.scanner.scan_source(testdir)
# run scanner as if from `fdroid build`
count = fdroidserver.scanner.scan_source(build_dir)
self.assertEqual(6, count, 'there should be this many errors')
for f in keep + binaries:
self.assertTrue(os.path.exists(f), f + ' should still be there')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment