Example #1
0
def test_unregister_with_qualified_name():
    # Given an action list with name conflict,
    actions = [custom_action, init_git, api.init_git]
    # When an action is unregistered by "qualified" name,
    actions = helpers.unregister(actions, 'pyscaffold.api:init_git')
    # Then the correct match should be removed
    assert actions == [custom_action, init_git]
Example #2
0
def test_unregister():
    # Given an action list with name conflict,
    actions = [custom_action, init_git, api.init_git]
    # When an action is unregistered by name,
    actions = helpers.unregister(actions, 'init_git')
    # Then the first match should be removed
    assert actions == [custom_action, api.init_git]
Example #3
0
def test_unregister_with_undefined_action():
    # Given an action list,
    actions = [api.init_git]
    # When a undefined action is unregistered,
    with pytest.raises(ActionNotFound):
        # Then the proper exception should be raised,
        actions = helpers.unregister(actions, 'undefined_action')
    # And the action list should remain the same
    assert actions == [api.init_git]