3 # http://www.drdobbs.com/testing/unit-testing-with-python/240165163
11 localmodule = os.path.realpath(
12 os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
13 print('localmodule: ' + localmodule)
14 if localmodule not in sys.path:
15 sys.path.insert(0, localmodule)
17 import fdroidserver.common
18 import fdroidserver.metadata
19 # work around the syntax error from: import fdroidserver.import
23 class ImportTest(unittest.TestCase):
26 def test_import_gitlab(self):
27 # FDroidPopen needs some config to work
28 fdroidserver.common.config = dict()
29 fdroidserver.common.config['sdk_path'] = '/fake/path/to/android-sdk'
31 url = 'https://gitlab.com/fdroid/fdroidclient'
32 app = fdroidserver.metadata.get_default_app_info()
33 app.UpdateCheckMode = "Tags"
34 root_dir, src_dir = import_proxy.get_metadata_from_url(app, url)
35 self.assertEquals(app.RepoType, 'git')
36 self.assertEquals(app.WebSite, 'https://gitlab.com/fdroid/fdroidclient')
37 self.assertEquals(app.Repo, 'https://gitlab.com/fdroid/fdroidclient.git')
40 if __name__ == "__main__":
41 parser = optparse.OptionParser()
42 parser.add_option("-v", "--verbose", action="store_true", default=False,
43 help="Spew out even more information than normal")
44 (fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
46 newSuite = unittest.TestSuite()
47 newSuite.addTest(unittest.makeSuite(ImportTest))