def test_do_exit(demoenv): c, d = demoenv assert Cmddocs(c).do_exit('exit') == True
def test_do_edit_log_commitmsg(demoenv, capsys): c, d = demoenv Cmddocs(c).do_log("testfile1") out, err = capsys.readouterr() assert "small changes" in out
def test_do_initializaton(emptyenv, capsys): c, d = emptyenv Cmddocs(c).do_status("test") out, err = capsys.readouterr() assert "On branch master" in out
def test_do_search(demoenv, capsys): c, d = demoenv Cmddocs(c).do_search("test") out, err = capsys.readouterr() assert out.startswith("Articles:")
def test_do_delete_log_commitmsg(demoenv, capsys): c, d = demoenv Cmddocs(c).do_log("") out, err = capsys.readouterr() assert "testfile1 deleted\n" in out
def test_do_l_fail(demoenv, capsys): c, d = demoenv Cmddocs(c).do_l("NEVEREVER") out, err = capsys.readouterr() assert out.startswith("NEVEREVER [error opening dir]")
def test_do_search_content(demoenv, capsys): c, d = demoenv Cmddocs(c).do_search("test") out, err = capsys.readouterr() assert "Content:" in out
def test_do_cd_fail(demoenv, capsys): c, d = demoenv Cmddocs(c).do_cd("dir7") out, err = capsys.readouterr() assert out == "Error: Directory dir7 not found\n"
def test_do_dirs_fail(demoenv, capsys): c, d = demoenv Cmddocs(c).do_dirs("dir7") out, err = capsys.readouterr() assert out.startswith("dir7 [error opening dir]\n\n0 directories\n\n")
def test_do_stats_articlecount(demoenv, capsys): c, d = demoenv Cmddocs(c).do_stats("test") out, err = capsys.readouterr() assert "Articles: 14" in out
def test_do_cd(demoenv, capsys): c, d = demoenv Cmddocs(c).do_cd("dir2") out, err = capsys.readouterr() assert "" in out
def test_do_stats_start(demoenv, capsys): c, d = demoenv Cmddocs(c).do_stats("test") out, err = capsys.readouterr() assert out.startswith("Newest Commit:")
def test_do_stats_charcount(demoenv, capsys): c, d = demoenv Cmddocs(c).do_stats("test") out, err = capsys.readouterr() assert "Characters: 2892" in out
def test_do_stats_end(demoenv, capsys): c, d = demoenv Cmddocs(c).do_stats("test") out, err = capsys.readouterr() assert "Characters" in out
def test_do_l_start(demoenv, capsys): c, d = demoenv Cmddocs(c).do_l(d) out, err = capsys.readouterr() assert "tmp/demodocs" in out
def test_do_dirs_subdir(demoenv, capsys): c, d = demoenv Cmddocs(c).do_dirs("dir1") out, err = capsys.readouterr() assert out.startswith("dir1")
def test_do_list_end(demoenv, capsys): c, d = demoenv Cmddocs(c).do_list(d) out, err = capsys.readouterr() assert out.endswith("14 files\n\n")
def test_do_dirs_pwd(demoenv, capsys): c, d = demoenv Cmddocs(c).do_dirs(".") out, err = capsys.readouterr() assert out.endswith('\n3 directories\n\n')
def test_do_search_results(demoenv, capsys): c, d = demoenv Cmddocs(c).do_search("test") out, err = capsys.readouterr() assert out.endswith("Results: 50\n")
def test_do_pwd(demoenv, capsys): c, d = demoenv Cmddocs(c).do_pwd(d) out, err = capsys.readouterr() assert ".\n" in out
def test_do_search_noresults(demoenv, capsys): c, d = demoenv Cmddocs(c).do_search("SOMETHINGTHATWILLNEVERBEFOUND") out, err = capsys.readouterr() assert out == "Articles:\nContent:\nResults: 0\n"
def test_do_log_file(demoenv, capsys): c, d = demoenv Cmddocs(c).do_log("testfile2") out, err = capsys.readouterr() assert out.startswith("Last 10 commits for testfile2.md\n")
def test_do_delete(demoenv, capsys): c, d = demoenv Cmddocs(c).do_delete("testfile1") out, err = capsys.readouterr() assert out == "testfile1 deleted\n"
def test_do_log_commitmsg(demoenv, capsys): c, d = demoenv Cmddocs(c).do_log("testfile2") out, err = capsys.readouterr() assert out.endswith("init\n")
#!/usr/bin/env python from cmddocs import Cmddocs if __name__ == '__main__': Cmddocs().cmdloop()
def test_do_log(demoenv, capsys): c, d = demoenv Cmddocs(c).do_log("10") out, err = capsys.readouterr() assert out.startswith("Last 10 commits\n")
def test_do_edit(demoenv, capsys): c, d = demoenv Cmddocs(c).do_edit("testfile1", test=True) out, err = capsys.readouterr() assert out.startswith("automatic change done")
#!/usr/bin/env python from cmddocs import Cmddocs if __name__ == '__main__': Cmddocs(conf="~/.cmddocsrc").cmdloop()
def test_do_undo_fail(demoenv, capsys): c, d = demoenv Cmddocs(c).do_undo('test') out, err = capsys.readouterr() assert out == "Error: Could not find given commit reference\n"
def test_do_version(demoenv, capsys): c, d = demoenv Cmddocs(c).do_version('test') out, err = capsys.readouterr() assert out.startswith('cmddocs ')