def tmplpath(fname):
    return os.path.abspath(
        os.path.join(
            selfdir(),
            "../../templates/1/common/debian/source",
            fname,
        ))
示例#2
0
        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")
示例#3
0
    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))
示例#4
0
    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))
示例#5
0
    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, "")
示例#6
0
    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)
示例#7
0
def tmplpath(fname):
    return os.path.abspath(
        os.path.join(selfdir(), "../../templates/1/rpmspec", fname)
    )
示例#8
0
        def test_01_load(self):
            cfgpath = os.path.join(C.selfdir(), "config_example_01.json")

            parser = A.JsonConfigPaser()
            config = parser.load(cfgpath)
示例#9
0
    def test_01_load(self):
        cfgpath = os.path.join(C.selfdir(), "config_example_01.ini")

        parser = A.IniConfigParser()
        config = parser.load(cfgpath)
示例#10
0
    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])
示例#11
0
def tmplpath(fname):
    return os.path.abspath(
        os.path.join(selfdir(), "../../templates/1/autotools", fname)
    )