2 # -*- coding: utf-8 -*-
4 # http://www.drdobbs.com/testing/unit-testing-with-python/240165163
12 localmodule = os.path.realpath(
13 os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
14 print('localmodule: ' + localmodule)
15 if localmodule not in sys.path:
16 sys.path.insert(0, localmodule)
18 import fdroidserver.common
19 import fdroidserver.metadata
20 # work around the syntax error from: import fdroidserver.import
24 class ImportTest(unittest.TestCase):
27 def test_import_gitlab(self):
28 # FDroidPopen needs some config to work
29 fdroidserver.common.config = dict()
30 fdroidserver.common.config['sdk_path'] = '/fake/path/to/android-sdk'
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.assertEquals(app.RepoType, 'git')
37 self.assertEquals(app.WebSite, 'https://gitlab.com/fdroid/fdroidclient')
38 self.assertEquals(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))