Exemplo n.º 1
0
def test_message_unreact():
    '''Message will be unreacted on the chat'''
    reset_data()
    data = auth_register('*****@*****.**', 'cs1531', 'Kevin', 'Trang')
    token = data['token']
    channel_id = channels_create(token, 'Channel One', True)
    message_id = message_send(token, channel_id['channel_id'], 'Hello World')
    message_react(token, message_id['message_id'], 1)
    assert message_unreact(token, message_id['message_id'], 1) == {}
Exemplo n.º 2
0
def test_message_invalid_react_id_in_react():
    '''Message will be not reacted with invalid react id on the chat'''
    reset_data()
    data = auth_register('*****@*****.**', 'cs1531', 'Kevin', 'Trang')
    token = data['token']
    channel_id = channels_create(token, 'Channel One', True)
    message_id = message_send(token, channel_id['channel_id'], 'Hello World')
    with pytest.raises(InputError):
        message_react(token, message_id['message_id'], 2)
Exemplo n.º 3
0
def test_message_invalid_unreact():
    '''Unreacted message will not be unreacted again'''
    reset_data()
    data = auth_register('*****@*****.**', 'cs1531', 'Kevin', 'Trang')
    token = data['token']
    channel_id = channels_create(token, 'Channel One', True)
    message_id = message_send(token, channel_id['channel_id'], 'Hello World')
    message_react(token, message_id['message_id'], 1)
    message_unreact(token, message_id['message_id'], 1)
    with pytest.raises(InputError):
        message_unreact(token, message_id['message_id'], 1)
Exemplo n.º 4
0
def message_react():
    input_data = request.get_json()
    token = input_data['token']
    message_id = input_data['message_id']
    react_id = input_data['react_id']
    returned_data = message_functions.message_react(token, message_id,
                                                    react_id)
    return dumps({})
Exemplo n.º 5
0
def react():
    '''Reacts a message by giving a react id from the user's token and message id'''
    details = request.get_json()
    return dumps(
        message_react(details['token'], details['channel_id'],
                      details['react_id']))