예제 #1
0
파일: test_cli.py 프로젝트: CowPanda/simiki
    def test_generate(self):
        self.args.update({u'generate': True})
        cli.execute(self.args)
        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
예제 #2
0
    def test_generate(self):
        self.args.update({u'generate': True})
        cli.execute(self.args)
        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
예제 #3
0
    def test_init(self):
        self.args.update({u'init': True, u'-p': self.target_path})
        cli.execute(self.args)
        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
예제 #4
0
파일: test_cli.py 프로젝트: CowPanda/simiki
    def test_generate_with_update_theme(self):
        self.args.update({u'generate': True, u'--update-theme': True})
        cli.execute(self.args)
        self.files.extend([os.path.join(self.output_path, "static", "css",
                                        "style.css")])
        self.dirs.extend([os.path.join(self.output_path, "static"),
                          os.path.join(self.output_path, "static", "css")])
        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
예제 #5
0
    def test_new_wiki_without_file(self):
        self.args.update({u'new': True, u'-t': self.title,
                          u'-c': self.category})
        cli.execute(self.args)
        self.assertTrue(os.path.isfile(self.ofile))

        with io.open(self.ofile, "rt", encoding="utf-8") as fd:
            lines = fd.readlines()
            # Ignore date line
            lines[2] = u''
        expected_lines = [u'---\n', u'title: "hello/simiki"\n',
                          u'', u'---\n', u'\n']
        assert lines == expected_lines
예제 #6
0
파일: test_cli.py 프로젝트: the7day/simiki
    def test_new_wiki_without_file(self):
        ofile = os.path.join(self.odir, "hello-slash-simiki.md")

        self.args.update({u'new': True, u'-t': self.title,
                          u'-c': self.category})
        cli.execute(self.args)
        self.assertTrue(os.path.isfile(ofile))

        with io.open(ofile, "rt", encoding="utf-8") as fd:
            lines = fd.read().rstrip().splitlines()
            # Ignore date line
            lines[2] = u''
        expected_lines = [u'---', u'title: "hello/simiki"', u'', u'---']
        assert lines == expected_lines
예제 #7
0
    def test_generate_with_update_theme(self):
        self.args.update({u'generate': True, u'--update-theme': True})
        cli.execute(self.args)
        self.files.extend(
            [os.path.join(self.output_path, "static", "css", "style.css")])
        self.dirs.extend([
            os.path.join(self.output_path, "static"),
            os.path.join(self.output_path, "static", "css")
        ])
        for f in self.files:
            self.assertTrue(os.path.isfile(os.path.join(self.target_path, f)))

        for d in self.dirs:
            self.assertTrue(os.path.isdir(os.path.join(self.target_path, d)))
예제 #8
0
    def test_new_wiki_without_file(self):
        ofile = os.path.join(self.odir, "hello-slash-simiki.md")

        self.args.update({
            u'new': True,
            u'-t': self.title,
            u'-c': self.category
        })
        cli.execute(self.args)
        self.assertTrue(os.path.isfile(ofile))

        with io.open(ofile, "rt", encoding="utf-8") as fd:
            lines = fd.read().rstrip().splitlines()
            # Ignore date line
            lines[2] = u''
        expected_lines = [u'---', u'title: "hello/simiki"', u'', u'---']
        assert lines == expected_lines