Ejemplo n.º 1
0
def test_perform_actions_single_parameter_exit(capsys):
    """Check to see if perform can invoke exit actions with a parameter"""
    actions = []
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        actions.append(
            [orchestrate.RUN, "run_exit", [orchestrate.INCORRECT_ARGUMENTS]])
        orchestrate.perform(actions)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 2
Ejemplo n.º 2
0
def test_perform_actions_display_welcome_and_ready_check_arguments(capsys):
    """Check the argument verification, messages, and continue"""
    chosen_arguments = ["--directory", "D", "--file", "f", "--exists"]
    arguments, actions = orchestrate.check_arguments(chosen_arguments)
    orchestrate.perform(actions)
    captured = capsys.readouterr()
    counted_newlines = captured.out.count("\n")
    assert arguments is not None
    assert "GatorGrader" in captured.out
    assert counted_newlines == 4
Ejemplo n.º 3
0
def test_perform_actions_no_parameters_incorrect(capsys):
    """Check to see if perform can invoke welcome action with no parameters"""
    actions = []
    actions.append([orchestrate.DISPLAY, "incorrect_message", []])
    orchestrate.perform(actions)
    captured = capsys.readouterr()
    counted_newlines = captured.out.count("\n")
    assert "Incorrect" in captured.out
    assert counted_newlines == 2
    assert captured.err == ""
Ejemplo n.º 4
0
def test_perform_actions_display_welcome_and_exit_check_arguments(capsys):
    """Check the argument verification, messages, and exit"""
    chosen_arguments = ["--directory", "D", "--file", "f"]
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        arguments, actions = orchestrate.check_arguments(chosen_arguments)
        assert arguments is not None
        orchestrate.perform(actions)
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 2
    captured = capsys.readouterr()
    counted_newlines = captured.out.count("\n")
    assert "GatorGrader" in captured.out
    assert counted_newlines == 6