Пример #1
0
def test_channel_details():
    BF.data['user_info'] = []
    BF.data['channel_info'] = []
    authRegisterDic = BF.user_register('*****@*****.**', '1234567', 'Andy', 'Wei') 
    result = BF.channels_create(authRegisterDic['token'], 'good team', True)
    BF.resetUser_id()
    BF.resetChannel_id()
    with pytest.raises(BF.ValueError):
        BF.channel_details(authRegisterDic['token'], result['channel_id'])
Пример #2
0
def test_channel_details_user_is_not_in_channel():
    BF.data['user_info'] = []
    BF.data['channel_info'] = []
    authRegisterDic = BF.user_register('*****@*****.**', '1234567', 'Andy', 'Wei') 
    authRegisterDic_02 = BF.user_register('*****@*****.**', '66666666', 'Andrew', 'Yeh') 
    result = BF.channels_create(authRegisterDic['token'], 'good team', True)
    BF.resetChannel_id()
    BF.resetUser_id()
    with pytest.raises(BF.AccessError):
        BF.channel_details(authRegisterDic_02['token'], result['channel_id'])
Пример #3
0
def test_channel_details():
    BF.data['user_info'] = []
    BF.data['channel_info'] = []
    authRegisterDic = BF.user_register('*****@*****.**', '1234567', 'Andy', 'Wei')
    result = BF.channels_create(authRegisterDic['token'], 'good team', True)
    BF.resetChannel_id()
    BF.resetUser_id()
    display_info = BF.channel_details(authRegisterDic['token'], result['channel_id'])
    assert display_info['name'] == 'good team'
    assert display_info['owner_members'] == [{'u_id': 1, 'name_first': 'Andy', 'name_last': 'Wei'}]
    assert display_info['all_members'] ==[{'u_id': 1, 'name_first': 'Andy', 'name_last': 'Wei'}]
Пример #4
0
def test_channels_create_valid():
    BF.data['user_info'] = []
    BF.data['channel_info'] = []
    BF.resetUser_id()
    BF.resetChannel_id()
    authRegisterDict = BF.user_register('*****@*****.**', '123456', 'real', 'bot')
    token1 = authRegisterDict['token']
    channelsCreateDict = BF.channels_create(token1, 'Channel 1', True)
    channelID = channelsCreateDict['channel_id']
    assert BF.channel_details(token1, channelID) == {
        'name': 'Channel 1',
        'all_members': [{'name_first': 'real', 'name_last': 'bot', 'u_id': 1}],
        'owner_members': [{'name_first': 'real', 'name_last': 'bot', 'u_id': 1}]
    }
Пример #5
0
def test_channel_details():
    BF.data['user_info'] = []
    BF.data['channel_info'] = []
    authRegisterDic = BF.user_register('*****@*****.**', '1234567', 'Andy', 'Wei')
    result = BF.channels_create(authRegisterDic['token'], 'good team', True)
    authRegisterDic_02 = BF.user_register('*****@*****.**', '66666666', 'Andrew', 'Yeh') 
    BF.channel_invite(authRegisterDic['token'], result['channel_id'], authRegisterDic_02['u_id'])
    print(result['channel_id'])
    print(authRegisterDic_02['u_id'])
    display_info = BF.channel_details(authRegisterDic['token'], result['channel_id'])
    BF.resetChannel_id()
    BF.resetUser_id()
    assert display_info['name'] == 'good team'
    assert display_info['owner_members'] == [{'u_id': 1, 'name_first': 'Andy', 'name_last': 'Wei'}]
    assert display_info['all_members'] ==[{'u_id': 1, 'name_first': 'Andy', 'name_last': 'Wei'},
    {'u_id': 2, 'name_first': 'Andrew', 'name_last': 'Yeh'}]