def test_message_react_invalid_react(): a_token = login('*****@*****.**', 'pass123456')[1] msg1_id = message_send(a_token, 1, 'a second test message') with pytest.raises(HTTPError): message_react(a_token, msg1_id, 2) logout(a_token)
def test_message_unreact_not_in_channel(): c_token = register('*****@*****.**', 'ssap12652', 'Chen', 'Bee')[1] channel_join(c_token, 1) msg1_id = message_send(c_token, 1, 'I am new here.') message_react(c_token, msg1_id, 1) channel_leave(c_token, 1) with pytest.raises(HTTPError): message_unreact(c_token, 1, 1) logout(c_token)
def test_message_unreact_own(reset): a_token = register('*****@*****.**', 'pass123456', 'Alan', 'Brown')[1] channel_id = channels_create(a_token, 'test_public', True) msg0_id = message_send(a_token, channel_id, 'test message please react') message_react(a_token, msg0_id, 1) # unreacting message_unreact(a_token, msg0_id, 1) msg_list = channel_messages(a_token, channel_id, 0)[0] assert msg_list[0]['reacts'][0]['u_ids'] == [] logout(a_token)
def test_message_react_already_reacted(): a_token = login('*****@*****.**', 'pass123456')[1] channel_id_priv = channels_create(a_token, 'test_private', False) msg1_id = message_send(a_token, channel_id_priv, 'test message please react') message_react(a_token, msg1_id, 1) with pytest.raises(HTTPError): message_react(a_token, msg1_id, 1) logout(a_token)
def test_message_unreact_invalid_token(): a_token = login('*****@*****.**', 'pass123456')[1] with pytest.raises(HTTPError): message_react(a_token + 'x', 0, 1) logout(a_token)
def test_message_react_nonexistent_message_id(): a_token = login('*****@*****.**', 'pass123456')[1] with pytest.raises(HTTPError): message_react(a_token, 2222, 1) logout(a_token)
def test_message_react_not_in_channel(): k_token = register('*****@*****.**', 'kenis123', 'Ken', 'Li')[1] with pytest.raises(HTTPError): message_react(k_token, 1, 1) logout(k_token)