Exemplo n.º 1
0
def test_successful_react():
    # successful thumb up
    user1 = user_from_token(token1)
    msg_id4 = data['channels'][0].messages[3].message_id
    assert msg_react(token1, msg_id4, 1) == {}
    assert data['channels'][0].messages[3].reactions[0].react_id == 1
    assert data['channels'][0].messages[3].reactions[
        0].reacter == user_from_token(token1).u_id
    assert user1.reacted_msgs[0] == msg_id4
Exemplo n.º 2
0
def route_msg_react():
    token = request.form.get('token')
    msg_id = int(request.form.get('message_id'))
    react_id = int(request.form.get('react_id'))
    return dumps(msg_react(token, msg_id, react_id))
Exemplo n.º 3
0
def test_react_msgid_notvalid():
    # when the message_id is not valid
    with pytest.raises(ValueError):
        msg_react(token1, 6666, 1)
Exemplo n.º 4
0
def test_reactid_notvalid():
    # when not passing in 1 as react id
    msg_id3 = data['channels'][0].messages[2].message_id
    with pytest.raises(ValueError):
        msg_react(token1, msg_id3, 2)
Exemplo n.º 5
0
def test_reacted():
    # when the message is already reacted
    msg_id4 = data['channels'][0].messages[3].message_id
    with pytest.raises(ValueError):
        msg_react(token1, msg_id4, 1)