def METHOD_NAME(
        client, patron_martigny, system_librarian_martigny, json_header,
        mailbox):
    """Test users profile updates."""
    # login with a patron has only the patron role, this means we are logging
    # into the public interface
    assert patron_martigny.patron['communication_channel'] == \
        CommunicationChannel.MAIL
    login_user_via_session(client, patron_martigny.user)
    # mailbox is empty
    assert not (len(mailbox))
    user_metadata = User.get_record(patron_martigny.user.id).dumps_metadata()
    # changing the email by another does not send any reset_password
    # notification
    user_metadata['email'] = 'toto@toto.com'
    res = client.put(
        url_for('api_users.users_item', id=patron_martigny.user.id),
        data=json.dumps(user_metadata),
        headers=json_header
    )
    assert res.status_code == 200
    assert not (len(mailbox))
    patron_martigny = Patron.get_record_by_pid(patron_martigny.pid)
    # an email was added to patron, communication_channel will change
    # automatically to email
    assert patron_martigny.patron.get('communication_channel') == \
        CommunicationChannel.EMAIL
    # removing the email from profile does not send any reset_password
    # notification
    user_metadata.pop('email', None)
    res = client.put(
        url_for(
            'api_users.users_item',
            id=patron_martigny.user.id),
        data=json.dumps(user_metadata),
        headers=json_header
    )
    assert res.status_code == 200
    assert not (len(mailbox))
    # the corresponding patron changes its communication_channel to mail
    # autmoatically if user has no email configured and patron has no
    # additional_communication_email configured
    patron_martigny = Patron.get_record_by_pid(patron_martigny.pid)
    assert patron_martigny.patron.get('communication_channel') == \
        CommunicationChannel.MAIL
    # login as a system_librarian this means we are logging into the
    # professional interface
    login_user_via_session(client, system_librarian_martigny.user)
    # adding an email to a profile does not send any reset_password
    # notification
    user_metadata['email'] = 'toto@toto.com'
    res = client.put(
        url_for(
            'api_users.users_item',
            id=patron_martigny.user.id),
        data=json.dumps(user_metadata),
        headers=json_header
    )
    assert res.status_code == 200
    assert not (len(mailbox))
    # removing the email from profile does not send any reset_password
    # notification
    user_metadata.pop('email', None)
    res = client.put(
        url_for(
            'api_users.users_item',
            id=patron_martigny.user.id),
        data=json.dumps(user_metadata),
        headers=json_header
    )
    assert res.status_code == 200
    assert not (len(mailbox))
    patron_martigny = Patron.get_record_by_pid(patron_martigny.pid)
    assert patron_martigny.patron.get('communication_channel') == \
        CommunicationChannel.MAIL