Exemple #1
0
def test_equivalent_downstream_only(mock_repo):
    """
    GIVEN GitWrapperCherry initialized with a path and repo
    WHEN equivalent is called with mix HEAD only changes.
    THEN an empty dictionary is returned.
    """
    cherry = GitWrapperCherry('./', mock_repo)
    lines = '+ sha1 commit1\n+ sha2 commit2\n+ sha3 commit3'
    attrs = {'cherry.return_value': lines}
    mock_repo.git.configure_mock(**attrs)
    assert {} == cherry.equivalent('upstream', 'HEAD')
Exemple #2
0
def test_equivalent_no_changes(mock_repo):
    """
    GIVEN GitWrapperCherry initialized with a path and repo
    WHEN equivalent is called with no changes.
    THEN an empty dictionary is returned.
    """
    cherry = GitWrapperCherry('./', mock_repo)
    lines = ''
    attrs = {'cherry.return_value': lines}
    mock_repo.git.configure_mock(**attrs)
    assert {} == cherry.equivalent('upstream', 'HEAD')
Exemple #3
0
def test_equivalent_mixed_changes(mock_repo):
    """
    GIVEN GitWrapperCherry initialized with a path and repo
    WHEN equivalent is called with mix equivalent and HEAD changes.
    THEN a dictionary is returned with only the equivalent changes.
    """
    cherry = GitWrapperCherry('./', mock_repo)
    lines = '+ sha1 commit1\n- sha2 commit2\n+ sha3 commit3'
    attrs = {'cherry.return_value': lines}
    mock_repo.git.configure_mock(**attrs)
    expected = {'sha2': 'commit2'}
    assert expected == cherry.equivalent('upstream', 'HEAD')