def test_edit_channel(channel_edited):
    while db.channel.count() < 3:
        rest.channel.create(random_channel())
    old_channels = db.channel.get_channels()
    channel_to_edit = choice(old_channels)
    channel_edited.id = channel_to_edit.id
    app.channel.edit_channel_by_id(channel_edited)
    # sleep(1)
    new_channels = db.channel.get_channels()
    # banners validation
    for ch in new_channels:
        if ch == channel_edited:
            # print ch, channel_edited
            # print channel_edited.icon["user_file"], ch.icon["server_file"]
            assert rest.compare_files_CRC(channel_edited.icon["user_file"], ch.icon["server_file"])
            assert rest.compare_files_CRC(channel_edited.narrow_banner["user_file"], ch.narrow_banner["server_file"])
            assert rest.compare_files_CRC(channel_edited.wide_banner["user_file"], ch.wide_banner["server_file"])
            break
    # print old_channels, type(old_channels)
    old_channels.remove(channel_to_edit)
    old_channels.append(channel_edited)
    assert len(new_channels) == len(old_channels)
    print sorted(old_channels, key=Channel.id_or_max)
    print sorted(new_channels, key=Channel.id_or_max)
    assert sorted(old_channels, key=Channel.id_or_max) == sorted(new_channels, key=Channel.id_or_max)
Пример #2
0
def test_delete_some_channel():
    while db.channel.count() < 3:
        rest.channel.create(random_channel())
    old_channels = db.channel.get_channels()
    channel = choice(old_channels)
    app.channel.delete_channel_by_id(channel.id)
    new_channels = db.channel.get_channels()
    assert db.channel.count() == len(old_channels) - 1
    assert len(new_channels) == len(old_channels) - 1
    old_channels.remove(channel)
    assert sorted(old_channels, key=Channel.id_or_max) == sorted(new_channels, key=Channel.id_or_max)
Пример #3
0
def test_delete_first_channel():
    while db.channel.count() < 3:
        rest.channel.create(random_channel())
    old_channels = app.channel.get_channels()
    app.channel.delete_channel_by_index(0)
    # sleep(1)
    new_channels = app.channel.get_channels()
    # print "new_channels", new_channels
    assert len(new_channels) == len(old_channels) - 1
    old_channels[0:1] = []
    assert old_channels == new_channels
def test_delete_first_channel():
    while db.channel.count() < 3:
        rest.channel.create(random_channel())
    old_channels = app.channel.get_channels()
    app.channel.delete_channel_by_index(0)
    # sleep(1)
    new_channels = app.channel.get_channels()
    # print "new_channels", new_channels
    assert len(new_channels) == len(old_channels) - 1
    old_channels[0:1] = []
    assert old_channels == new_channels
def test_delete_some_channel():
    while db.channel.count() < 3:
        rest.channel.create(random_channel())
    old_channels = db.channel.get_channels()
    channel = choice(old_channels)
    app.channel.delete_channel_by_id(channel.id)
    new_channels = db.channel.get_channels()
    assert db.channel.count() == len(old_channels) - 1
    assert len(new_channels) == len(old_channels) - 1
    old_channels.remove(channel)
    assert sorted(old_channels,
                  key=Channel.id_or_max) == sorted(new_channels,
                                                   key=Channel.id_or_max)
Пример #6
0
def test_create_channel_positive_not_unique_fields():
    # ENSURE EXIST FEW CHANNELS
    while db.channel.count() < 1:
        rest.channel.create(random_channel())
    old_channels = db.channel.get_channels()
    new_channel = copy.copy(choice(old_channels))
    new_channel.id = None
    new_channel.icon["server_file"] = None
    new_channel.narrow_banner["server_file"] = None
    new_channel.wide_banner["server_file"] = None
    new_channel.name = 'Channel_not_unique_not_required_fields_' + str(randint(0, 9999999))
    app.channel.create(new_channel)
    new_channels = db.channel.get_channels()
    assert db.channel.count() == len(old_channels) + 1
    old_channels.append(new_channel)
    # print "old_channels:", sorted(old_channels, key=Channel.id_or_max)
    # print "new_channels:", sorted(new_channels, key=Channel.id_or_max)
    assert sorted(old_channels, key=Channel.id_or_max) == sorted(new_channels, key=Channel.id_or_max)
Пример #7
0
def test_create_channel_positive_not_unique_fields():
    # ENSURE EXIST FEW CHANNELS
    while db.channel.count() < 1:
        rest.channel.create(random_channel())
    old_channels = db.channel.get_channels()
    new_channel = copy.copy(choice(old_channels))
    new_channel.id = None
    new_channel.icon["server_file"] = None
    new_channel.narrow_banner["server_file"] = None
    new_channel.wide_banner["server_file"] = None
    new_channel.name = 'Channel_not_unique_not_required_fields_' + str(
        randint(0, 9999999))
    app.channel.create(new_channel)
    new_channels = db.channel.get_channels()
    assert db.channel.count() == len(old_channels) + 1
    old_channels.append(new_channel)
    # print "old_channels:", sorted(old_channels, key=Channel.id_or_max)
    # print "new_channels:", sorted(new_channels, key=Channel.id_or_max)
    assert sorted(old_channels,
                  key=Channel.id_or_max) == sorted(new_channels,
                                                   key=Channel.id_or_max)