'Make sure data containing invalid UTF8 raises SessionError.'

@webengine_refactoring_xfail
def test_utf_8_invalid(self, tmpdir, sess_man, fake_history):

    session_path = (tmpdir / 'foo.yml')
    fake_history([Item(QUrl('http://www.qutebrowser.org/'), '\\ud800', active=True)])
    try:
        sess_man.save(str(session_path))
    except sessions.SessionError:
        pass
    else:
        data = session_path.read_text('utf-8')
        assert ('title:    "\\uD800"' in data)
