Beispiel #1
0
def test_adder_not_member():
    clear()
    user_0, user_1, user_2 = create_three_test_users() 
    public_channel = channels_create(user_0['token'], "name", True)
    channel_join(user_2['token'], public_channel['channel_id']) 
    with pytest.raises(error.AccessError):
        assert channel_addowner(user_1['token'], public_channel['channel_id'], user_2['u_id']) == {}
def test_channel_removeowner_only_owner():
    clear()
    _, user_1, user_2 = create_three_test_users()
    public_channel = channels_create(user_1['token'], "name", True)
    channel_join(user_2['token'], public_channel['channel_id'])
    with pytest.raises(error.InputError):
        assert channel_removeowner(user_1['token'],
                                   public_channel['channel_id'],
                                   user_1['u_id']) == {}
def test_channel_removeowner_owner_success():
    clear()
    user_0, user_1, user_2 = create_three_test_users()
    public_channel = channels_create(user_0['token'], "name", True)
    channel_join(user_1['token'], public_channel['channel_id'])
    channel_join(user_2['token'], public_channel['channel_id'])
    channel_addowner(user_0['token'], public_channel['channel_id'],
                     user_1['u_id'])
    assert channel_removeowner(user_1['token'], public_channel['channel_id'],
                               user_1['u_id']) == {}
Beispiel #4
0
def test_message_remove_flockr_owner():

    clear()
    test_user0, test_user1, test_user2 = create_three_test_users()

    # test_user1 creates 1 public channel
    public_channel_id = channels_create(test_user1['token'], "Main Channel",
                                        True)

    # test_user2 joins public channel
    channel_join(test_user2['token'], public_channel_id['channel_id'])

    # test_user1 sends 1 message
    message0 = "Let's geddit"
    message0_id = message_send(test_user1['token'],
                               public_channel_id['channel_id'], message0)

    # check test_user0 (flockr owner) removes their message
    assert message_remove(test_user0['token'], message0_id['message_id']) == {}