1
0
Fork 0
mirror of synced 2024-10-01 09:41:03 +13:00
bulk-downloader-for-reddit/tests/site_downloaders/test_streamable.py
2021-04-30 09:22:26 +10:00

26 lines
814 B
Python

#!/usr/bin/env python3
# coding=utf-8
from unittest.mock import MagicMock
import pytest
from bdfr.resource import Resource
from bdfr.site_downloaders.streamable import Streamable
@pytest.mark.online
@pytest.mark.slow
@pytest.mark.parametrize(('test_url', 'expected_hash'), (
('https://streamable.com/dt46y', '1e7f4928e55de6e3ca23d85cc9246bbb'),
('https://streamable.com/t8sem', '49b2d1220c485455548f1edbc05d4ecf')
))
def test_find_resources(test_url: str, expected_hash: str):
test_submission = MagicMock()
test_submission.url = test_url
downloader = Streamable(test_submission)
resources = downloader.find_resources()
assert len(resources) == 1
assert isinstance(resources[0], Resource)
resources[0].download(120)
assert resources[0].hash.hexdigest() == expected_hash