def METHOD_NAME(cli, datafiles, deps, expected_states):
    project = str(datafiles)
    target = "bananas.bst"
    build_dep = "apples.bst"
    runtime_dep = "oranges.bst"
    # Assert that none of the sources are cached
    states = cli.get_element_states(project, [target, build_dep, runtime_dep])
    assert all(state == "fetch needed" for state in states.values())
    # Now fetch the specified sources
    result = cli.run(project=project, args=["source", "fetch", "--deps", deps, target])
    result.assert_success()
    # Finally assert that we have fetched _only_ the desired sources
    states = cli.get_element_states(project, [target, build_dep, runtime_dep])
    states_flattened = (states[target], states[build_dep], states[runtime_dep])
    assert states_flattened == expected_states