1
0
Fork 0
mirror of synced 2024-06-02 18:34:37 +12:00
bulk-downloader-for-reddit/tests/site_downloaders/test_pornhub.py

26 lines
768 B
Python
Raw Normal View History

2021-06-25 19:47:49 +12:00
#!/usr/bin/env python3
# coding=utf-8
from unittest.mock import MagicMock
import pytest
from bdfr.resource import Resource
from bdfr.site_downloaders.pornhub import PornHub
@pytest.mark.online
@pytest.mark.slow
@pytest.mark.parametrize(('test_url', 'expected_hash'), (
2021-10-02 15:23:13 +13:00
('https://www.pornhub.com/view_video.php?viewkey=ph6074c59798497', 'd9b99e4ebecf2d8d67efe5e70d2acf8a'),
2021-06-25 19:47:49 +12:00
))
def test_find_resources_good(test_url: str, expected_hash: str):
test_submission = MagicMock()
test_submission.url = test_url
downloader = PornHub(test_submission)
resources = downloader.find_resources()
assert len(resources) == 1
assert isinstance(resources[0], Resource)
2021-07-27 15:39:49 +12:00
resources[0].download()
2021-06-25 19:47:49 +12:00
assert resources[0].hash.hexdigest() == expected_hash