def METHOD_NAME(mock_tools):
    """If the sudo call fails, an exception is raised."""
    mock_tools.subprocess.check_output.side_effect = subprocess.CalledProcessError(
        cmd=["/usr/bin/clang", "--version"],
        returncode=69,
    )
    mock_tools.subprocess.run.side_effect = subprocess.CalledProcessError(
        cmd=["sudo", "xcodebuild", "-license"],
        returncode=69,
    )
    # Check raises an error:
    with pytest.raises(
        BriefcaseCommandError, match=r"Xcode license has not been accepted."
    ):
        XcodeCliTools.confirm_xcode_license_accepted(mock_tools)
    # ... clang *and* xcodebuild were invoked ...
    mock_tools.subprocess.check_output.assert_called_once_with(
        ["/usr/bin/clang", "--version"],
    )
    mock_tools.subprocess.run.assert_called_once_with(
        ["sudo", "xcodebuild", "-license"],
        check=True,
        stream_output=False,
    )