Beispiel #1
0
def test_channels_list():
    reset_data()
    # SETUP BEGIN
    # Assume all users have registered in function: test_channel_invite()
    auth_dic1 = auth_register("*****@*****.**", "123456", "firstone",
                              "lastone")
    auth_dic1 = auth_login("*****@*****.**", "123456")
    token1 = auth_dic1['token']

    auth_dic2 = auth_register("*****@*****.**", "123456", "firstone",
                              "lastone")
    auth_dic2 = auth_login("*****@*****.**", "123456")
    token2 = auth_dic2['token']

    channels_create(token1, "channel 1", True)

    # SETUP END

    # successful test
    channels_list(token1)
    assert channels_list(token2) == {'channels': []}

    # logout
    auth_logout(token1)
    auth_logout(token2)

    reset_data()
Beispiel #2
0
def search(token, query_str):
    data = load()
    messDict = data['messDict']
    channel_list = channels_list(token)['channels']
    cha_ids = []
    for cha in channel_list:
        cha_ids.append(cha['channel_id'])
    lis = []
    for meg in messDict:
        if meg['channel_id'] in cha_ids:
            if meg['message'] == query_str:
                mess = {
                    'message_id': meg['message_id'],
                    'u_id': meg['u_id'],
                    'message': meg['message'],
                    'time_created': meg['time_created'],
                    'reacts': meg['reacts'],
                    'is_pinned': meg['is_pinned']
                }
                lis.append(mess)
    return {'messages': lis}
Beispiel #3
0
def channel_list():
    token = request.args.get("token")
    lis = channels_list(token)
    return dumps(lis)
def run_channels_list():
    request_data = request.args
    return_value = channel.channels_list(request_data["token"])

    return dumps(return_value)
Beispiel #5
0
def app_channels_list():
    token = get_args('token')

    return dumps(channels_list(token))