def METHOD_NAME(mock_tools):
    """If `flatpak-builder --version` fails, an error is raised."""
    # Mock the side effect of an unsuccessful call to flatpak-builder
    mock_tools.subprocess.check_output.side_effect = [
        "Flatpak 1.12.7",
        subprocess.CalledProcessError(cmd="flatpak-builder --version", returncode=1),
    ]
    with pytest.raises(
        BriefcaseCommandError,
        match=r"Unable to invoke flatpak-builder.",
    ):
        Flatpak.verify(mock_tools)
    mock_tools.subprocess.check_output.assert_has_calls(
        [
            mock.call(["flatpak", "--version"]),
            mock.call(["flatpak-builder", "--version"]),
        ],
        any_order=False,
    )