2021-03-01 17:53:07 +13:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# coding=utf-8
|
|
|
|
|
|
|
|
import praw
|
|
|
|
import pytest
|
|
|
|
|
2021-04-12 19:58:32 +12:00
|
|
|
from bdfr.resource import Resource
|
|
|
|
from bdfr.site_downloaders.vreddit import VReddit
|
2021-03-01 17:53:07 +13:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.online
|
|
|
|
@pytest.mark.reddit
|
2021-04-23 23:05:49 +12:00
|
|
|
@pytest.mark.parametrize('test_submission_id', (
|
|
|
|
'lu8l8g',
|
2021-03-01 17:53:07 +13:00
|
|
|
))
|
2021-04-17 23:07:20 +12:00
|
|
|
def test_find_resources(test_submission_id: str, reddit_instance: praw.Reddit):
|
2021-03-01 17:53:07 +13:00
|
|
|
test_submission = reddit_instance.submission(id=test_submission_id)
|
|
|
|
downloader = VReddit(test_submission)
|
|
|
|
resources = downloader.find_resources()
|
|
|
|
assert len(resources) == 1
|
|
|
|
assert isinstance(resources[0], Resource)
|
2021-04-12 18:47:04 +12:00
|
|
|
resources[0].download(120)
|
2021-04-17 23:07:20 +12:00
|
|
|
assert resources[0].content is not None
|