mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
tests: add check that we trigger a scanner error without setting it as extlib
This commit is contained in:
parent
d07b4123e9
commit
059ebd4bc9
1 changed files with 12 additions and 1 deletions
|
|
@ -214,7 +214,6 @@ class BuildTest(unittest.TestCase):
|
||||||
build = fdroidserver.metadata.Build()
|
build = fdroidserver.metadata.Build()
|
||||||
build.commit = 'master'
|
build.commit = 'master'
|
||||||
build.androidupdate = ['no']
|
build.androidupdate = ['no']
|
||||||
build.extlibs = ['android/android-support-v4r11.jar']
|
|
||||||
os.makedirs("extlib/android")
|
os.makedirs("extlib/android")
|
||||||
# write a fake binary jar file the scanner should definitely error on
|
# write a fake binary jar file the scanner should definitely error on
|
||||||
with open('extlib/android/android-support-v4r11.jar', 'wb') as file:
|
with open('extlib/android/android-support-v4r11.jar', 'wb') as file:
|
||||||
|
|
@ -228,12 +227,24 @@ class BuildTest(unittest.TestCase):
|
||||||
def getsrclib(self):
|
def getsrclib(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Test we trigger a scanner error without extlibs
|
||||||
|
build.extlibs = []
|
||||||
|
os.makedirs('build/libs')
|
||||||
|
shutil.copy('extlib/android/android-support-v4r11.jar', 'build/libs')
|
||||||
|
fdroidserver.common.prepare_source(FakeVcs(), app, build,
|
||||||
|
"build", "ignore", "extlib")
|
||||||
|
count = fdroidserver.scanner.scan_source("build", build)
|
||||||
|
self.assertEqual(1, count, "Should produce a scanner error without extlib")
|
||||||
|
|
||||||
|
# Now try again as an extlib
|
||||||
|
build.extlibs = ['android/android-support-v4r11.jar']
|
||||||
fdroidserver.common.prepare_source(FakeVcs(), app, build,
|
fdroidserver.common.prepare_source(FakeVcs(), app, build,
|
||||||
"build", "ignore", "extlib")
|
"build", "ignore", "extlib")
|
||||||
count = fdroidserver.scanner.scan_source("build", build)
|
count = fdroidserver.scanner.scan_source("build", build)
|
||||||
self.assertEqual(0, count, "Shouldn't error on jar from extlib")
|
self.assertEqual(0, count, "Shouldn't error on jar from extlib")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue