def METHOD_NAME(monkeypatch):
    monkeypatch.setattr(profile, 'invalidate_other_sessions', lambda x: '')
    from weasyl.login import verify_email_change
    password = "01234556789"
    username = "test0042"
    email = "test@weasyl.com"
    userid = db_utils.create_user(username=username, password=password, email_addr=email)
    # Case 1: No changes, user authentication succeeds
    assert not profile.edit_email_password(
        userid=userid,
        password=password,
        newemail="",
        newpassword="",
    )
    # Case 2: No changes, user authentication fails
    with pytest.raises(WeasylError) as err:
        profile.edit_email_password(
            userid=userid,
            password="notTheRightPassword",
            newemail="",
            newpassword="",
        )
    assert 'passwordIncorrect' == err.value.value
    # Case 3: Changes, new password only, password too short/'insecure'
    with pytest.raises(WeasylError) as err:
        profile.edit_email_password(
            userid=userid,
            password=password,
            newemail="",
            newpassword="012345",
        )
    assert 'passwordInsecure' == err.value.value
    # Case 5: Changes, new password only, password change succeeds
    result = profile.edit_email_password(
        userid=userid,
        password=password,
        newemail="",
        newpassword="1122334455",
    )
    assert "Your password has been successfully changed" in result
    password = "1122334455"
    # Case 7: Changes, new email only, email already in use
    db_utils.create_user(email_addr="testB@weasyl.com")
    profile.edit_email_password(
        userid=userid,
        password=password,
        newemail="testB@weasyl.com",
        newpassword="",
    )
    query = d.engine.scalar("""
        SELECT email FROM emailverify WHERE userid = %(userid)s LIMIT 1
    """, userid=userid)
    assert not query
    # Case 8: Changes, new email only, email change succeeds
    newemailaddr = "testC@weasyl.com"
    result = profile.edit_email_password(
        userid=userid,
        password=password,
        newemail=newemailaddr,
        newpassword="",
    )
    assert "Your email change request is currently pending" in result
    query = d.engine.execute("""
        SELECT userid, email, token, createtimestamp
        FROM emailverify
        WHERE userid = %(userid)s
    """, userid=userid).fetchone()
    QID, QEMAIL, QTOKEN, QTIMESTAMP = query
    assert QID == userid
    assert QEMAIL == newemailaddr
    assert len(QTOKEN) == 40
    assert arrow.get(QTIMESTAMP)
    # Now that we have the token, let's also verify that ``login.verify_email_change`` works.
    #   It's as good a place as any.
    # Case 8.1/8.2: Make sure invalid token and/or userid doesn't work.
    with pytest.raises(WeasylError) as err:
        verify_email_change(None, "a")
    assert "Unexpected" == err.value.value
    with pytest.raises(WeasylError) as err:
        verify_email_change(1, None)
    assert "Unexpected" == err.value.value
    # Case 8.3: An incorrect token is provided.
    with pytest.raises(WeasylError) as err:
        verify_email_change(userid, "a")
    assert "ChangeEmailVerificationTokenIncorrect" == err.value.value
    # Case 8.4: Correct token is provided, and the new email is written to `login`
    result = verify_email_change(userid, QTOKEN)
    assert result == newemailaddr
    query = d.engine.scalar("""
        SELECT email
        FROM login
        WHERE userid = %(userid)s
    """, userid=userid)
    assert query == QEMAIL
    # Case 9: Email and password changed at the same time.
    newemailaddr = "testD@weasyl.com"
    newpassword = "test123_test123_test123"
    result = profile.edit_email_password(
        userid=userid,
        password=password,
        newemail=newemailaddr,
        newpassword=newpassword,
    )
    assert "Your password has been successfully changed" in result
    assert "Your email change request is currently pending" in result