def test_channel_leave_8(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", 'true') channel2 = channels_create(owner_token, "Second Channel", 'true') channel3 = channels_create(owner_token, "Third Channel", 'true') channel4 = channels_create(owner_token, "Fourth Channel", 'true') channel_id1 = channel1['channel_id'] channel_id2 = channel2['channel_id'] channel_id3 = channel3['channel_id'] channel_id4 = channel4['channel_id'] channel_join(u_token, channel_id1) channel_join(u_token, channel_id2) channel_join(u_token, channel_id3) channel_join(u_token, channel_id4) channel_leave(u_token, channel_id3) assert (channels_list(u_token) == { 'channels': [{ 'channel_id': channel_id1, 'name': "Channel Name" }, { 'channel_id': channel_id2, 'name': "Second Channel" }, { 'channel_id': channel_id4, 'name': "Fourth Channel" }] })
def test_channel_leave_6(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", 'true') channel_id1 = channel1['channel_id'] channel_join(u_token, channel_id1) channel_leave(u_token, channel_id1) assert (channels_list(u_token) == {'channels': []})
def test_channel_leave_3(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", 'true') channel_id1 = channel1['channel_id'] channel_join(u_token, channel_id1) invalid_channel_id = channel_id1 + 1 with pytest.raises(ValueError): channel_leave(u_token, invalid_channel_id)
def test_channel_leave_4(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", 'true') channel2 = channels_create(owner_token, "Second Channel", 'true') channel3 = channels_create(owner_token, "Third Channel", 'true') channel_id1 = channel1['channel_id'] channel_id2 = channel2['channel_id'] channel_id3 = channel3['channel_id'] channel_join(u_token, channel_id1) channel_join(u_token, channel_id2) with pytest.raises(ValueError): channel_leave(u_token, channel_id3)
def test_channel_leave_7(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", 'true') channel2 = channels_create(owner_token, "Second Channel", 'true') channel_id1 = channel1['channel_id'] channel_id2 = channel2['channel_id'] channel_join(u_token, channel_id1) channel_join(u_token, channel_id2) channel_leave(u_token, channel_id1) assert (channels_list(u_token) == { 'channels': [{ 'channel_id': channel_id2, 'name': "Second Channel" }] })
def test_channel_details_4(): token1, u_id1, token2, u_id2 = setup() dict3 = channels_create(token1, 'someChannel', 'true') channel_id1 = dict3['channel_id'] channel_invite(token1, channel_id1, u_id2) channel_leave(token1, channel_id1) assert (channel_details(token2, channel_id1) == { 'name': 'someChannel', 'owner_members': [], 'all_members': [{ 'u_id': u_id2, 'name_first': 'Peter', 'name_last': 'Steven', 'profile_img_url': None }] })
def test_channel_leave_2(): owner_token, owner_id, u_token, u_id = setup() channel = channels_create(owner_token, "Channel Name", 'true') channel_id = channel['channel_id'] with pytest.raises(ValueError): channel_leave(u_token, channel_id)
def test_channel_leave_1(): owner_token, owner_id, u_token, u_id = setup() with pytest.raises(ValueError): channel_leave(u_token, 1234)