Exemplo n.º 1
0
def test_continue_running_no_asserts_no_remaining():
    actions = [Action(name="some-action")]
    asserts = []

    assert not testing.continue_running(
        actions=actions,
        asserts=asserts,
        remaining_cycles=0,
        actions_data={},
        assert_statuses={},
    )
Exemplo n.º 2
0
def test_continue_running_actions_with_asserts_first_run():
    actions = [Action(name="bar", asserts=[Assert(name="foo")])]
    asserts = []

    assert testing.continue_running(
        actions=actions,
        asserts=asserts,
        remaining_cycles=-1,
        actions_data={},
        assert_statuses={},
    )
Exemplo n.º 3
0
def test_continue_running_actions_with_asserts_failed_limited_second_run():
    actions = [Action(name="bar", asserts=[Assert(name="foo")])]
    asserts = []

    actions_data = {
        "bar": {
            "asserts": {
                "foo":
                AssertResult(passed=False,
                             actual="",
                             expected="",
                             description="")
            }
        }
    }

    assert not testing.continue_running(
        actions=actions,
        asserts=asserts,
        remaining_cycles=0,
        actions_data=actions_data,
        assert_statuses={},
    )
Exemplo n.º 4
0
def action_has_asserts(action: Action):
    return action.get("asserts", []) != []
Exemplo n.º 5
0
def test_get_default_cycles_actions_have_asserts():
    default_cycles = testing.get_default_cycles(
        asserts=[], actions=[Action(name="bar", asserts=[Assert(name="foo")])])

    assert default_cycles == -1
Exemplo n.º 6
0
def test_get_default_cycles_actions_only():
    default_cycles = testing.get_default_cycles(asserts=[],
                                                actions=[Action(name="bar")])

    assert default_cycles == 1