mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
Add a simple test for scanner
This commit is contained in:
parent
62d1c672f3
commit
5dee23f7a6
33
tests/scanner.TestCase
Executable file
33
tests/scanner.TestCase
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import unittest
|
||||
import optparse
|
||||
from pathlib import Path
|
||||
from os.path import basename, dirname, realpath
|
||||
|
||||
from fdroidserver import scanner
|
||||
from fdroidserver.metadata import Build
|
||||
import fdroidserver.common
|
||||
|
||||
|
||||
class ScannerTest(unittest.TestCase):
|
||||
def test_scan_source_files(self):
|
||||
source_files = Path(dirname(realpath(__file__)), 'source-files')
|
||||
projects = {
|
||||
'Zillode': 1,
|
||||
'firebase-suspect': 1
|
||||
}
|
||||
for d in source_files.iterdir():
|
||||
fatal_problems = scanner.scan_source(d, Build())
|
||||
self.assertEqual(projects.get(basename(d), 0), fatal_problems)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||
help="Spew out even more information than normal")
|
||||
(fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
|
||||
|
||||
newSuite = unittest.TestSuite()
|
||||
newSuite.addTest(unittest.makeSuite(ScannerTest))
|
||||
unittest.main(failfast=False)
|
5
tests/source-files/firebase-suspect/app/build.gradle
Normal file
5
tests/source-files/firebase-suspect/app/build.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
dependencies {
|
||||
compile 'com.google.firebase:firebase-core:11.6.2'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
11
tests/source-files/firebase-suspect/build.gradle
Normal file
11
tests/source-files/firebase-suspect/build.gradle
Normal file
@ -0,0 +1,11 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url "https://maven.google.com" }
|
||||
}
|
||||
}
|
5
tests/source-files/firebase-whitelisted/app/build.gradle
Normal file
5
tests/source-files/firebase-whitelisted/app/build.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
dependencies {
|
||||
compile 'com.firebase:firebase-jobdispatcher:0.8.4'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
14
tests/source-files/firebase-whitelisted/build.gradle
Normal file
14
tests/source-files/firebase-whitelisted/build.gradle
Normal file
@ -0,0 +1,14 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user