1
0
Fork 0
mirror of synced 2024-07-05 06:20:29 +12:00
bulk-downloader-for-reddit/bulkredditdownloader/tests/downloaders/test_self_post.py
2021-04-18 16:44:05 +03:00

24 lines
778 B
Python

#!/usr/bin/env python3
# coding=utf-8
import praw
import pytest
from bulkredditdownloader.resource import Resource
from bulkredditdownloader.site_downloaders.self_post import SelfPost
@pytest.mark.online
@pytest.mark.reddit
@pytest.mark.parametrize(('test_submission_id', 'expected_hash'), (
('ltmivt', '7d2c9e4e989e5cf2dca2e55a06b1c4f6'),
('ltoaan', '221606386b614d6780c2585a59bd333f'),
))
def test_find_resource(test_submission_id: str, expected_hash: str, reddit_instance: praw.Reddit):
submission = reddit_instance.submission(id=test_submission_id)
downloader = SelfPost(submission)
results = downloader.find_resources()
assert len(results) == 1
assert isinstance(results[0], Resource)
assert results[0].hash.hexdigest() == expected_hash