mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	These days, the location that overrides all the others is in the android{}
block of the build.gradle file that loads the com.android.application
plugin.  So this should be the preferred place to read these values.
test files GPL licensed: https://github.com/Integreight/1Sheeld-Android-App
		
	
			
		
			
				
	
	
		
			56 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env python3
 | 
						|
 | 
						|
import glob
 | 
						|
import inspect
 | 
						|
import logging
 | 
						|
import optparse
 | 
						|
import os
 | 
						|
import sys
 | 
						|
import unittest
 | 
						|
 | 
						|
localmodule = os.path.realpath(
 | 
						|
    os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
 | 
						|
print('localmodule: ' + localmodule)
 | 
						|
if localmodule not in sys.path:
 | 
						|
    sys.path.insert(0, localmodule)
 | 
						|
 | 
						|
import fdroidserver.common
 | 
						|
import fdroidserver.metadata
 | 
						|
import fdroidserver.scanner
 | 
						|
 | 
						|
 | 
						|
class ScannerTest(unittest.TestCase):
 | 
						|
 | 
						|
    def setUp(self):
 | 
						|
        logging.basicConfig(level=logging.INFO)
 | 
						|
        self.basedir = os.path.join(localmodule, 'tests')
 | 
						|
 | 
						|
    def test_scan_source_files(self):
 | 
						|
        source_files = os.path.join(self.basedir, 'source-files')
 | 
						|
        projects = {
 | 
						|
            'cn.wildfirechat.chat': 4,
 | 
						|
            'com.integreight.onesheeld': 11,
 | 
						|
            'Zillode': 1,
 | 
						|
            'firebase-suspect': 1,
 | 
						|
            'org.mozilla.rocket': 3,
 | 
						|
            'realm': 1,
 | 
						|
        }
 | 
						|
        for d in glob.glob(os.path.join(source_files, '*')):
 | 
						|
            build = fdroidserver.metadata.Build()
 | 
						|
            fatal_problems = fdroidserver.scanner.scan_source(d, build)
 | 
						|
            should = projects.get(os.path.basename(d), 0)
 | 
						|
            self.assertEqual(should, fatal_problems,
 | 
						|
                             "%s should have %d errors!" % (d, should))
 | 
						|
 | 
						|
 | 
						|
if __name__ == "__main__":
 | 
						|
    os.chdir(os.path.dirname(__file__))
 | 
						|
 | 
						|
    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)
 |