def test_get_valid_ref_with_origin_current_branch(self):
        """Test that _get_valid_ref returns the current branch in origin when it exists."""
        # This test uses the setup from setUp where the current branch exists in origin
        ref = self.git_handler._get_valid_ref()
        self.assertIsNotNone(ref)

        # Check that the refs were checked in the correct order
        verify_commands = [
            cmd
            for cmd, _ in self.executed_commands
            if cmd.startswith('git --no-pager rev-parse --verify')
        ]

        # First should check origin/feature-branch (current branch)
        self.assertTrue(any('origin/feature-branch' in cmd for cmd in verify_commands))

        # Should have found a valid ref (origin/feature-branch)
        self.assertEqual(ref, 'origin/feature-branch')

        # Verify the ref exists
        result = self._execute_command(
            f'git --no-pager rev-parse --verify {ref}', self.local_dir
        )
        self.assertEqual(result.exit_code, 0)
Test that _get_valid_ref returns the current branch in origin when it exists.
tests/unit/test_git_handler.py