def test_ok_list_markdown_files(self): dirpath = Path.cwd().joinpath("mocks") # ok walk = False exp = [ str(Path.cwd().joinpath("mocks/post_1.md")), str(Path.cwd().joinpath("mocks/post_2.md")) ] act = MetaPostReader._list_markdown_files(dirpath) self.assertEqual(exp, act) # walk = True dirpath = Path.cwd().joinpath("mocks") exp = [ str(Path.cwd().joinpath("mocks/post_1.md")), str(Path.cwd().joinpath("mocks/post_2.md")), str(Path.cwd().joinpath("mocks/bad_format/post_99.md")) ] act = MetaPostReader._list_markdown_files(dirpath, walk=True) self.assertEqual(exp, act)
def test_raise_list_markdown_files(self): with self.assertRaises(MetaPostError): null_dirpath = Path.cwd().joinpath("null_dirpath") MetaPostReader._list_markdown_files(null_dirpath)