def test_early_exit_no_commits( self, mock_fetch_head_only, mock_get_base_revision, mock_fetch_full_history, mock_get_subject_markers, mock_has_merge_commits, ): base_ref = "baseref" base_hash = "123abc" mock_get_base_revision.return_value = base_hash mock_has_merge_commits.return_value = False self.assertEqual( 0, merge_checks.main(head_hash=base_hash, base_ref=base_ref)) mock_fetch_head_only.assert_called_once_with(base_ref) mock_get_base_revision.assert_called_once_with(base_ref) mock_fetch_full_history.assert_not_called() mock_get_subject_markers.assert_not_called() mock_has_merge_commits.assert_not_called()
def test_fixup_found( self, mock_fetch_head_only, mock_get_base_revision, mock_fetch_full_history, mock_get_subject_markers, mock_has_merge_commits, ): head_hash = "987xyz" base_ref = "baseref" base_hash = "123abc" mock_get_base_revision.return_value = base_hash mock_get_subject_markers.return_value = ("feat(component):", "fixup!") mock_has_merge_commits.return_value = False self.assertEqual( 1, merge_checks.main(head_hash=head_hash, base_ref=base_ref)) mock_fetch_head_only.assert_called_once_with(base_ref) mock_get_base_revision.assert_called_once_with(base_ref) mock_fetch_full_history.assert_called_once() mock_get_subject_markers.assert_called_once_with(head_hash, base_hash) mock_has_merge_commits.assert_not_called()