def test_git_create_branch_happy_case(mock_master_branch, mock_var, mock_args): """ Function to test gits_create_branch, success case """ mocked_pipe = Mock() attrs = {'communicate.return_value': ('output', 'error'), 'returncode': 0} mocked_pipe.configure_mock(**attrs) mock_var.return_value = mocked_pipe mock_args = parse_args(mock_args) test_result = create_branch(mock_args) if test_result: assert True, "Normal Case" else: assert False
def test_git_create_branch_sad_case_with_no_arguments(mock_master_branch, mock_var, mock_args): """ Function to test gits_create_branch, failure case with no arguments passed """ mocked_pipe = Mock() attrs = {'communicate.return_value': ('output', 'error'), 'returncode': 0} mocked_pipe.configure_mock(**attrs) mock_var.return_value = mocked_pipe mock_args = parse_args(mock_args) test_result = create_branch(mock_args) if not test_result: assert True, "Normal Case" else: assert False
def test_git_create_branch_happy_path(mock_popen, mock_args): """ Function to test gits_create_branch, success case """ test_result = gits_create_branch.create_branch(mock_args) assert test_result == True