Пример #1
0
def test_execute_scenario_destroy(mocker, _patched_execute_subcommand):
    # call a spoofed scenario with a sequence that includes destroy:
    # - execute_subcommand should be called once for each sequence item
    # - prune should be called, since the sequence has a destroy step
    scenario = mocker.Mock()
    scenario.sequence = ('a', 'b', 'destroy', 'c')

    base.execute_scenario(scenario)

    assert _patched_execute_subcommand.call_count == len(scenario.sequence)
    assert scenario.prune.called
Пример #2
0
def test_execute_scenario(mocker, _patched_execute_subcommand):
    # call a spoofed scenario with a sequence that does not include destroy:
    # - execute_subcommand should be called once for each sequence item
    # - prune should not be called, since the sequence has no destroy step
    scenario = mocker.Mock()
    scenario.sequence = ("a", "b", "c")

    base.execute_scenario(scenario)

    assert _patched_execute_subcommand.call_count == len(scenario.sequence)
    assert not scenario.prune.called
Пример #3
0
def test_execute_scenario_destroy(mocker, _patched_execute_subcommand):
    # call a spoofed scenario with a sequence that includes destroy:
    # - execute_subcommand should be called once for each sequence item
    # - prune should be called, since the sequence has a destroy step
    scenario = mocker.Mock()
    scenario.sequence = ('a', 'b', 'destroy', 'c')

    base.execute_scenario(scenario)

    assert _patched_execute_subcommand.call_count == len(scenario.sequence)
    # scenario.config.action is mutated in-place for every sequence action,
    # so make sure that is currently set to the last executed action
    assert scenario.config.action == scenario.sequence[-1]
    assert scenario.prune.called