예제 #1
0
def test_print_failure(capsys):
    dbbuddy = Db.DbBuddy(", ".join(ACCNS))
    failure = Db.Failure("foobar", "You just foo'd a bar")
    dbbuddy.failures[failure.hash] = failure
    dbbuddy.print()
    out, err = capsys.readouterr()
    assert err == '''# ########################## Failures ########################### #
예제 #2
0
def test_liveshell_do_failures(monkeypatch, capsys):
    monkeypatch.setattr(Db.LiveShell, "cmdloop", mock_cmdloop)
    monkeypatch.setattr(Db.LiveShell, "dump_session", lambda _: True)
    dbbuddy = Db.DbBuddy()
    crash_file = br.TempFile(byte_mode=True)
    liveshell = Db.LiveShell(dbbuddy, crash_file)

    liveshell.do_failures("Blahh")
    out, err = capsys.readouterr()
    assert "No failures to report\n\n" in out

    dbbuddy.failures["Foo"] = Db.Failure("Bar", "Fake failure")
    liveshell.do_failures()
    out, err = capsys.readouterr()
    assert "The following failures have occured\n" in out
    assert "Bar\nFake failure" in out
예제 #3
0
def test_failure_class():
    failure = Db.Failure("Q9JIJ4BYE", "Blahhh")
    assert failure.query == "Q9JIJ4BYE"
    assert failure.error_msg == "Blahhh"
    assert failure.hash == "26b3561cfa1e7047863784ece10867d4"
    assert str(failure) == "Q9JIJ4BYE\nBlahhh\n"