Example #1
0
    def test_01__parse__none(self):
        listfile = "/a/b/c/path.conf"
        config = init_config(listfile)

        line = "# this is a comment line to be ignored\n"

        collector = FilelistCollector(listfile, config)
        fos = collector._parse(line)

        self.assertEquals(fos, [])
Example #2
0
    def test_02__parse__single_virtual_file(self):
        listfile = "/a/b/c/path.conf"
        config = init_config(listfile)

        line = " %s,create=1,content=\"generated file\" \n" % listfile

        collector = FilelistCollector(listfile, config)
        fos = collector._parse(line)
        fos_ref = [Factory.create(listfile, False,
                                  create=1, content="generated file")]

        self.assertNotEquals(fos, [])
        self.assertEquals(fos, fos_ref)
Example #3
0
    def test_01__parse__multi_real_file(self):
        listfile = os.path.join(self.workdir, "file.list")
        listfile2 = os.path.join(self.workdir, "file2.list")
        config = init_config(listfile)

        line = "%s/file*.list\n" % self.workdir
        open(listfile, "w").write(line)
        open(listfile2, "w").write(line)

        collector = FilelistCollector(listfile, config)
        fos = collector._parse(line)
        fos_ref = [Factory.create(listfile), Factory.create(listfile2)]

        self.assertEquals(sorted(fos), sorted(fos_ref))