def test_author_detailed_found(self): with tmp_folder() as tmp_dir: create_project_structure(tmp_dir, 'one_post') cmd = Commands({'<name>': 'john'}) with capture() as output: cmd.authors() regex = re.compile(r".*A post example.*", re.DOTALL) self.assertTrue(regex.match(output[0]))
def test_author_not_found(self, l): with tmp_folder() as tmp_dir: create_project_structure(tmp_dir, 'one_post') cmd = Commands({'<name>': 'Foo'}) cmd.authors() self.assertEqual( "Author 'Foo' not found.", l.records[0].getMessage() )
def test_no_authors_founds(self, l): with tmp_folder() as tmp_dir: create_project_structure(tmp_dir, 'empty_project') cmd = Commands({}) cmd.authors() self.assertEqual( "No authors found.", l.records[0].getMessage() )