示例#1
0
def test_message_unpin_not_member(new_channel_and_user,
                                  new_channel_and_user_2):
    """ Test that try to unpin a message by a user who is not one of members"""
    message = message_send(new_channel_and_user['token'],
                           new_channel_and_user['channel_id'], 'adcd')
    with pytest.raises(AccessError):
        message_unpin(new_channel_and_user_2['token'], message['message_id'])
示例#2
0
def test_message_already_unpinned(new_channel_and_user):
    """ Test that try to unpin a message that has already been pinned"""
    message = message_send(new_channel_and_user['token'],
                           new_channel_and_user['channel_id'], 'adcd')

    with pytest.raises(InputError):
        message_unpin(new_channel_and_user['token'], message['message_id'])
示例#3
0
def test_message_unpin_not_owner(new_channel_and_user, new_channel_and_user_2):
    """ Test that try to unpin a message but not the owner"""
    message = message_send(new_channel_and_user['token'],
                           new_channel_and_user['channel_id'], 'adcd')
    channel_invite(new_channel_and_user['token'],
                   new_channel_and_user['channel_id'],
                   new_channel_and_user_2['u_id'])
    message_pin(new_channel_and_user['token'], message['message_id'])

    with pytest.raises(InputError):
        message_unpin(new_channel_and_user_2['token'], message['message_id'])
示例#4
0
def message_unpin_wsgi():
    json = request.get_json()
    return jsonify(message_unpin(json['token'], json['message_id']))
示例#5
0
def test_message_unpin_invalid_msg_id(new_channel_and_user):
    """ Test that if the message is invalid"""
    with pytest.raises(InputError):
        message_unpin(new_channel_and_user['token'], -1)