def test_gits_pull_happy_case_with_commit_and_given_branch( mock_current_branch, mock_var, mock_args): """ Function to test gits pull, success case with commits, rebase and given branch """ mocked_pipe = Mock() attrs = {'communicate.return_value': (b'', 'error'), 'returncode': 0} mocked_pipe.configure_mock(**attrs) mock_var.return_value = mocked_pipe mock_args = parse_args(mock_args) test_result = gits_pull(mock_args) if test_result: assert True, "Normal Case" else: assert False
def test_gits_pull_sad_case_with_no_commit_and_rebase(mock_current_branch, mock_var, mock_args): """ Function to test gits pull, failure case with no commits, but rebase """ mocked_pipe = Mock() attrs = {'communicate.return_value': (b'', 'error'), 'returncode': 0} mocked_pipe.configure_mock(**attrs) mock_var.return_value = mocked_pipe mock_args = parse_args(mock_args) test_result = gits_pull(mock_args) if not test_result: assert True, "Normal Case" else: assert False
def test_gits_pull_sad_case_with_uncommitted_changes(mock_var, mock_args): """ Function to test gits pull, failure case with uncommited changes """ mocked_pipe = Mock() attrs = { 'communicate.return_value': (b'anything', 'error'), 'returncode': 0 } mocked_pipe.configure_mock(**attrs) mock_var.return_value = mocked_pipe mock_args = parse_args(mock_args) test_result = gits_pull(mock_args) if not test_result: assert True, "Normal Case" else: assert False