Exemple #1
0
def test_display_all(capsys, mock_init):
    cm.display()
    captured = capsys.readouterr()
    assert captured.out == ("\nbibmanager configuration file:\n"
                            "PARAMETER    VALUE\n"
                            "-----------  -----\n"
                            "style        autumn\n"
                            "text_editor  default\n"
                            "paper        letter\n"
                            "ads_token    None\n"
                            "ads_display  20\n")
def test_display_each(capsys, mock_init):
    cm.display("style")
    captured = capsys.readouterr()
    assert captured.out == "style: autumn\n"
    cm.display("text_editor")
    captured = capsys.readouterr()
    assert captured.out == "text_editor: default\n"
    cm.display("paper")
    captured = capsys.readouterr()
    assert captured.out == "paper: letter\n"
    cm.display("ads_token")
    captured = capsys.readouterr()
    assert captured.out == "ads_token: None\n"
    cm.display("ads_display")
    captured = capsys.readouterr()
    assert captured.out == "ads_display: 20\n"
def test_display_each_raises(mock_init):
    with pytest.raises(
            ValueError,
            match="'invalid_param' is not a valid bibmanager config parameter."
    ):
        cm.display("invalid_param")