Example #1
0
def test_do_exit(demoenv):
    c, d = demoenv
    assert Cmddocs(c).do_exit('exit') == True
Example #2
0
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
Example #3
0
def test_do_initializaton(emptyenv, capsys):
    c, d = emptyenv
    Cmddocs(c).do_status("test")
    out, err = capsys.readouterr()
    assert "On branch master" in out
Example #4
0
def test_do_search(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_search("test")
    out, err = capsys.readouterr()
    assert out.startswith("Articles:")
Example #5
0
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
Example #6
0
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]")
Example #7
0
def test_do_search_content(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_search("test")
    out, err = capsys.readouterr()
    assert "Content:" in out
Example #8
0
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"
Example #9
0
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")
Example #10
0
def test_do_stats_articlecount(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_stats("test")
    out, err = capsys.readouterr()
    assert "Articles: 14" in out
Example #11
0
def test_do_cd(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_cd("dir2")
    out, err = capsys.readouterr()
    assert "" in out
Example #12
0
def test_do_stats_start(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_stats("test")
    out, err = capsys.readouterr()
    assert out.startswith("Newest Commit:")
Example #13
0
def test_do_stats_charcount(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_stats("test")
    out, err = capsys.readouterr()
    assert "Characters: 2892" in out
Example #14
0
def test_do_stats_end(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_stats("test")
    out, err = capsys.readouterr()
    assert "Characters" in out
Example #15
0
def test_do_l_start(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_l(d)
    out, err = capsys.readouterr()
    assert "tmp/demodocs" in out
Example #16
0
def test_do_dirs_subdir(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_dirs("dir1")
    out, err = capsys.readouterr()
    assert out.startswith("dir1")
Example #17
0
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")
Example #18
0
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')
Example #19
0
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")
Example #20
0
def test_do_pwd(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_pwd(d)
    out, err = capsys.readouterr()
    assert ".\n" in out
Example #21
0
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"
Example #22
0
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")
Example #23
0
def test_do_delete(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_delete("testfile1")
    out, err = capsys.readouterr()
    assert out == "testfile1 deleted\n"
Example #24
0
def test_do_log_commitmsg(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_log("testfile2")
    out, err = capsys.readouterr()
    assert out.endswith("init\n")
Example #25
0
#!/usr/bin/env python

from cmddocs import Cmddocs

if __name__ == '__main__':
    Cmddocs().cmdloop()
Example #26
0
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")
Example #27
0
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")
Example #28
0
#!/usr/bin/env python

from cmddocs import Cmddocs

if __name__ == '__main__':
    Cmddocs(conf="~/.cmddocsrc").cmdloop()
Example #29
0
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"
Example #30
0
def test_do_version(demoenv, capsys):
    c, d = demoenv
    Cmddocs(c).do_version('test')
    out, err = capsys.readouterr()
    assert out.startswith('cmddocs ')