Example #1
0
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': []})
Example #2
0
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"
        }]
    })
Example #3
0
def test_channel_join_6():
    owner_token, owner_id, u_token, u_id = setup()
    channel = channels_create(owner_token, "Name", "true")
    channel_id = channel['channel_id']
    channel_join(u_token, channel_id)
    assert(channels_list(u_token) == {
        'channels': [
            {'channel_id': channel_id, 'name': "Name"}
        ]
    })
Example #4
0
def test_channel_join_11():
    owner_token, owner_id, u_token, u_id = setup()
    channel = channels_create(owner_token, "Private Channel", "false")
    channel_id = channel['channel_id']
    admin_userpermission_change(owner_token, u_id, 2)
    channel_join(u_token, channel_id)
    assert(channels_list(u_token) == {
        'channels': [
            {'channel_id': channel_id, 'name': "Private Channel"}
        ]
    })
Example #5
0
def test_channel_list_4():
    owner_token, owner_id, owner_token2, owner_id2, u_token, u_id = setup()
    channel1 = channels_create(owner_token, "Name", "true")
    channel_id1 = channel1['channel_id']
    channel_join(u_token, channel_id1)
    assert (channels_list(u_token) == {
        'channels': [{
            'channel_id': channel_id1,
            'name': "Name"
        }]
    })
Example #6
0
def test_channel_join_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")
    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_id2)
    assert(channels_list(u_token) == {
        'channels': [
            {'channel_id': channel_id2, 'name': "Second Channel"}
        ]
    })
Example #7
0
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"
        }]
    })
Example #8
0
def test_channel_list_6():
    owner_token, owner_id, owner_token2, owner_id2, u_token, u_id = setup()
    channel1 = channels_create(owner_token, "Name1", "true")
    channel2 = channels_create(owner_token, "Name2", "true")
    channel3 = channels_create(owner_token, "Name3", "true")
    channel_id1 = channel1['channel_id']
    channel_id2 = channel2['channel_id']
    channel_join(u_token, channel_id1)
    channel_join(u_token, channel_id2)
    assert (channels_list(u_token) == {
        'channels': [{
            'channel_id': channel_id1,
            'name': "Name1"
        }, {
            'channel_id': channel_id2,
            'name': "Name2"
        }]
    })
Example #9
0
def test_channel_join_13():
    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, "Private1", "false")
    channel5 = channels_create(owner_token, "Private2", "false")
    channel6 = channels_create(owner_token, "Private3", "false")
    channel_id2 = channel2['channel_id']
    channel_id3 = channel3['channel_id']
    channel_id5 = channel5['channel_id']
    admin_userpermission_change(owner_token, u_id, 2)
    channel_join(u_token, channel_id2)
    channel_join(u_token, channel_id3)
    channel_join(u_token, channel_id5)
    assert(channels_list(u_token) == {
        'channels': [
            {'channel_id': channel_id2, 'name': "Second Channel"},
            {'channel_id': channel_id3, 'name': "Third Channel"},
            {'channel_id': channel_id5, 'name': "Private2"}
        ]
    })
Example #10
0
def test_channels_list_3():
    owner_token, owner_id, owner_token2, owner_id2, u_token, u_id = setup()
    channel1 = channels_create(owner_token, "Name1", "true")
    channel2 = channels_create(owner_token, "Name2", "true")
    assert (channels_list(u_token) == {'channels': []})
Example #11
0
def test_channels_list_1():
    owner_token, owner_id, owner_token2, owner_id2, u_token, u_id = setup()
    assert (channels_list(u_token) == {'channels': []})