Ejemplo n.º 1
0
def test_register_default_position():
    # Given an action list with define_structure,
    pipeline = [orig_init_git, define_structure, init_git]
    # When a new action is registered without position reference,
    pipeline = register(pipeline, custom_action)
    # Then this action should be placed after define_structure
    assert pipeline == [orig_init_git, define_structure, custom_action, init_git]
Ejemplo n.º 2
0
def test_register_after():
    # Given an action list,
    pipeline = [orig_init_git]
    # When a new action is registered after another, using the function name
    # as position reference,
    pipeline = register(pipeline, custom_action, after="init_git")
    # Then this action should be correctly placed
    assert pipeline == [orig_init_git, custom_action]
Ejemplo n.º 3
0
def test_register_with_invalid_reference():
    # Given an action list,
    pipeline = [orig_init_git]
    # When a new action is registered using an invalid reference,
    with pytest.raises(ActionNotFound):
        # Then the proper exception should be raised,
        pipeline = register(pipeline, custom_action, after="undefined_action")
    # And the action list should remain the same
    assert pipeline == [orig_init_git]