def tmplpath(fname): return os.path.abspath( os.path.join( selfdir(), "../../templates/1/common/debian/source", fname, ))
def test_00_load(self): cfgpath = os.path.join(C.selfdir(), "config_example_00.yaml") parser = A.YamlConfigPaser() config = parser.load(cfgpath) self.assertEquals(config.config, None) self.assertEquals(config.norc, False) self.assertEquals(config.force, False) self.assertEquals(config.verbosity, 0) self.assertEquals(config.name, "example-00-app") self.assertEquals(config.group, "System Environment/Base") self.assertEquals(config.license, "GPLv3+") self.assertEquals(config.url, "http://example.com") self.assertEquals(config.summary, "Example 00 app") self.assertEquals(config.arch, False) self.assertEquals(config.relations, "requires:/bin/sh") self.assertEquals(config.pversion, "0.0.1") self.assertEquals(config.release, 1) self.assertEquals(config.no_mock, True) self.assertNotEquals(config.files, []) self.assertEquals(config.files[0].path, "/a/b/c") self.assertEquals(config.files[0].attrs.create, 0) self.assertEquals(config.files[1].path, "/d/e")
def test_07_dump__json(self): conf0 = os.path.join(C.selfdir(), "config_example_01.json") conf1 = os.path.join(self.workdir, "dumped_config_example_01.json") parser = A.AnyConfigParser() data = parser.load(conf0) A.AnyConfigParser.dump(data, conf1) self.assertTrue(os.path.exists(conf1))
def test_00_template_compile(self): template_path = os.path.join(selfdir(), "template_example_00.tmpl") c0 = TT.compile(template_path, {}) c1 = TT.compile(template_path, {"title": "pyTenjin tests: context", }) # TBD: self.assertTrue(bool(c0)) self.assertTrue(bool(c1))
def test__package_spec(self): filelist = os.path.join( selfdir(), "config_example_01.json" ) args = "-n foo -C " + filelist pkgdata = BTC.init_pkgdata(args) # TODO: pkgdata.relations = [] context = pkgdata tmpl = tmplpath("package.spec") c = TW.template_compile(tmpl, context) self.assertNotEquals(c, "")
def helper(self, config, extra_args=[]): curdir = selfdir() conf = os.path.join(curdir, config) tmpldir = os.path.join(TOPDIR, "templates") logfile = os.path.join(self.workdir, "run.log") args = [ "dummy_argv0", "-n", "foo", "-w", self.workdir, "-C", conf, "-P", tmpldir, "-L", logfile, ] + extra_args rc = A.main(args) self.assertEquals(rc, 0)
def tmplpath(fname): return os.path.abspath( os.path.join(selfdir(), "../../templates/1/rpmspec", fname) )
def test_01_load(self): cfgpath = os.path.join(C.selfdir(), "config_example_01.json") parser = A.JsonConfigPaser() config = parser.load(cfgpath)
def test_01_load(self): cfgpath = os.path.join(C.selfdir(), "config_example_01.ini") parser = A.IniConfigParser() config = parser.load(cfgpath)
def test_00_run_w_ini_conf_and_filelist(self): filelist = os.path.join(selfdir(), "config_example_00_filelist") self.helper("config_example_01.ini", [filelist])
def tmplpath(fname): return os.path.abspath( os.path.join(selfdir(), "../../templates/1/autotools", fname) )