Rename class

This commit is contained in:
Serene-Arc
2022-07-15 15:05:07 +10:00
parent 4f876eecbc
commit 7d4eb47643
4 changed files with 9 additions and 9 deletions

View File

@@ -17,8 +17,8 @@ from bdfr.site_downloaders.pornhub import PornHub
from bdfr.site_downloaders.redgifs import Redgifs from bdfr.site_downloaders.redgifs import Redgifs
from bdfr.site_downloaders.self_post import SelfPost from bdfr.site_downloaders.self_post import SelfPost
from bdfr.site_downloaders.vidble import Vidble from bdfr.site_downloaders.vidble import Vidble
from bdfr.site_downloaders.vreddit import VReddit
from bdfr.site_downloaders.youtube import Youtube from bdfr.site_downloaders.youtube import Youtube
from bdfr.site_downloaders.vreddit import Vreddit
class DownloadFactory: class DownloadFactory:
@@ -49,7 +49,7 @@ class DownloadFactory:
elif re.match(r'i\.redd\.it.*', sanitised_url): elif re.match(r'i\.redd\.it.*', sanitised_url):
return Direct return Direct
elif re.match(r'v\.redd\.it.*', sanitised_url): elif re.match(r'v\.redd\.it.*', sanitised_url):
return Vreddit return VReddit
elif re.match(r'pornhub\.com.*', sanitised_url): elif re.match(r'pornhub\.com.*', sanitised_url):
return PornHub return PornHub
elif re.match(r'vidble\.com', sanitised_url): elif re.match(r'vidble\.com', sanitised_url):

View File

@@ -16,7 +16,7 @@ from bdfr.site_downloaders.base_downloader import BaseDownloader
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class Vreddit(BaseDownloader): class VReddit(BaseDownloader):
def __init__(self, post: Submission): def __init__(self, post: Submission):
super().__init__(post) super().__init__(post)

View File

@@ -16,8 +16,8 @@ from bdfr.site_downloaders.imgur import Imgur
from bdfr.site_downloaders.pornhub import PornHub from bdfr.site_downloaders.pornhub import PornHub
from bdfr.site_downloaders.redgifs import Redgifs from bdfr.site_downloaders.redgifs import Redgifs
from bdfr.site_downloaders.self_post import SelfPost from bdfr.site_downloaders.self_post import SelfPost
from bdfr.site_downloaders.vreddit import VReddit
from bdfr.site_downloaders.youtube import Youtube from bdfr.site_downloaders.youtube import Youtube
from bdfr.site_downloaders.vreddit import Vreddit
@pytest.mark.online @pytest.mark.online
@@ -43,13 +43,13 @@ from bdfr.site_downloaders.vreddit import Vreddit
('https://i.imgur.com/3SKrQfK.jpg?1', Direct), ('https://i.imgur.com/3SKrQfK.jpg?1', Direct),
('https://dynasty-scans.com/system/images_images/000/017/819/original/80215103_p0.png?1612232781', Direct), ('https://dynasty-scans.com/system/images_images/000/017/819/original/80215103_p0.png?1612232781', Direct),
('https://m.imgur.com/a/py3RW0j', Imgur), ('https://m.imgur.com/a/py3RW0j', Imgur),
('https://v.redd.it/9z1dnk3xr5k61', Vreddit), ('https://v.redd.it/9z1dnk3xr5k61', VReddit),
('https://streamable.com/dt46y', YtdlpFallback), ('https://streamable.com/dt46y', YtdlpFallback),
('https://vimeo.com/channels/31259/53576664', YtdlpFallback), ('https://vimeo.com/channels/31259/53576664', YtdlpFallback),
('http://video.pbs.org/viralplayer/2365173446/', YtdlpFallback), ('http://video.pbs.org/viralplayer/2365173446/', YtdlpFallback),
('https://www.pornhub.com/view_video.php?viewkey=ph5a2ee0461a8d0', PornHub), ('https://www.pornhub.com/view_video.php?viewkey=ph5a2ee0461a8d0', PornHub),
('https://www.patreon.com/posts/minecart-track-59346560', Gallery), ('https://www.patreon.com/posts/minecart-track-59346560', Gallery),
('https://v.redd.it/9z1dnk3xr5k61', Vreddit) ('https://v.redd.it/9z1dnk3xr5k61', VReddit)
)) ))
def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit): def test_factory_lever_good(test_submission_url: str, expected_class: BaseDownloader, reddit_instance: praw.Reddit):
result = DownloadFactory.pull_lever(test_submission_url) result = DownloadFactory.pull_lever(test_submission_url)

View File

@@ -7,7 +7,7 @@ import pytest
from bdfr.exceptions import NotADownloadableLinkError from bdfr.exceptions import NotADownloadableLinkError
from bdfr.resource import Resource from bdfr.resource import Resource
from bdfr.site_downloaders.vreddit import Vreddit from bdfr.site_downloaders.vreddit import VReddit
@pytest.mark.online @pytest.mark.online
@@ -18,7 +18,7 @@ from bdfr.site_downloaders.vreddit import Vreddit
def test_find_resources_good(test_url: str, expected_hash: str): def test_find_resources_good(test_url: str, expected_hash: str):
test_submission = MagicMock() test_submission = MagicMock()
test_submission.url = test_url test_submission.url = test_url
downloader = Vreddit(test_submission) downloader = VReddit(test_submission)
resources = downloader.find_resources() resources = downloader.find_resources()
assert len(resources) == 1 assert len(resources) == 1
assert isinstance(resources[0], Resource) assert isinstance(resources[0], Resource)
@@ -34,6 +34,6 @@ def test_find_resources_good(test_url: str, expected_hash: str):
def test_find_resources_bad(test_url: str): def test_find_resources_bad(test_url: str):
test_submission = MagicMock() test_submission = MagicMock()
test_submission.url = test_url test_submission.url = test_url
downloader = Vreddit(test_submission) downloader = VReddit(test_submission)
with pytest.raises(NotADownloadableLinkError): with pytest.raises(NotADownloadableLinkError):
downloader.find_resources() downloader.find_resources()