Exemplo n.º 1
0
def test_combined_filter_with_some_failed_flavors():
    test_flavors = [
        FailedFlavor('Failure'),
        StreamFlavor(streams=[MockBackend('ffmpeg', 2)],
                     bitrate=190,
                     width=224,
                     height=126,
                     media_type=''),
        StreamFlavor(streams=[MockBackend('ffmpeg', 3)],
                     bitrate=469,
                     width=640,
                     height=360,
                     media_type=''),
        FailedFlavor('Second failure'),
        StreamFlavor(streams=[MockBackend('ffmpeg', 5)],
                     bitrate=1506,
                     width=1280,
                     height=720,
                     media_type='')
    ]

    assert backend_data(filter_flavors(test_flavors)) == [5]
    assert backend_data(
        filter_flavors(test_flavors, max_height=720, max_bitrate=200)) == [2]
    assert backend_data(
        filter_flavors(test_flavors, max_height=400, max_bitrate=2000)) == [3]
Exemplo n.º 2
0
def test_combined_filter_bitrate_only_and_some_failures():
    test_flavors = [
        FailedFlavor('Failure'),
        StreamFlavor(streams=[MockBackend('ffmpeg', 1)],
                     bitrate=517,
                     media_type='video'),
        FailedFlavor('Second failure')
    ]

    assert backend_data(filter_flavors(test_flavors)) == [1]
    assert backend_data(filter_flavors(test_flavors, max_height=720)) == [1]
    assert backend_data(filter_flavors(test_flavors, max_bitrate=200)) == [1]
    assert backend_data(
        filter_flavors(test_flavors, max_height=720, max_bitrate=200)) == [1]
Exemplo n.º 3
0
def video_flavor(streams):
    return StreamFlavor(media_type='video', streams=streams)
Exemplo n.º 4
0
        self.name = name
        self.data = data

    def is_valid(self):
        return True


class MockGeoLocation(object):
    def located_in_finland(self, referrer):
        return True


flavors = [
    StreamFlavor(streams=[MockBackend('ffmpeg', 1)],
                 bitrate=190,
                 width=224,
                 height=126,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 5)],
                 bitrate=1506,
                 width=1280,
                 height=720,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 6)],
                 bitrate=2628,
                 width=1280,
                 height=720,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 7)],
                 bitrate=4128,
                 width=1920,
        self.name = name
        self.data = data

    def is_valid(self):
        return True


class MockGeoLocation(object):
    def located_in_finland(self, referrer):
        return True


flavors = [
    StreamFlavor(streams=[MockBackend('ffmpeg', 1)],
                 bitrate=190,
                 width=224,
                 height=126,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 5)],
                 bitrate=1506,
                 width=1280,
                 height=720,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 6)],
                 bitrate=2628,
                 width=1280,
                 height=720,
                 media_type=''),
    StreamFlavor(streams=[MockBackend('ffmpeg', 7)],
                 bitrate=4128,
                 width=1920,