def test_init(self): os.chdir(test_path) self.args.update({u'init': True, u'-p': self.target_path}) cli.main(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)))
def test_new_wiki_without_file(self): ofile = os.path.join(self.odir, "hello-slash-simiki.md") self.args.update({"new": True, "-t": self.title, "-c": self.category}) cli.main(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] = "" expected_lines = ["---", 'title: "hello/simiki"', "", "---"] assert lines == expected_lines
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.main(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
def test_generate(self): self.args.update({u'generate': True}) cli.main(self.args) for f in self.drafts: self.assertFalse(os.path.isfile(os.path.join(self.wiki_path, f))) for f in self.files: self.assertTrue(os.path.isfile(os.path.join(self.wiki_path, f))) for d in self.dirs: self.assertTrue(os.path.isdir(os.path.join(self.wiki_path, d))) for f in self.attach: self.assertTrue(os.path.isdir(os.path.join(self.wiki_path, d))) for f in self.static: self.assertTrue(os.path.isdir(os.path.join(self.wiki_path, d)))