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
29 fdroidserver.common.fill_config_defaults(config)
30 fdroidserver.common.config = config
32 url = 'https://gitlab.com/fdroid/fdroidclient'
33 app = fdroidserver.metadata.get_default_app_info()
34 app.UpdateCheckMode = "Tags"
35 root_dir, src_dir = import_proxy.get_metadata_from_url(app, url)
36 self.assertEqual(app.RepoType, 'git')
37 self.assertEqual(app.WebSite, 'https://gitlab.com/fdroid/fdroidclient')
38 self.assertEqual(app.Repo, 'https://gitlab.com/fdroid/fdroidclient.git')
41 if __name__ == "__main__":
42 parser = optparse.OptionParser()
43 parser.add_option("-v", "--verbose", action="store_true", default=False,
44 help="Spew out even more information than normal")
45 (fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
47 newSuite = unittest.TestSuite()
48 newSuite.addTest(unittest.makeSuite(ImportTest))