1
0
Fork 0
mirror of synced 2024-06-02 10:24:39 +12:00
bulk-downloader-for-reddit/tests/site_downloaders/test_self_post.py

28 lines
834 B
Python
Raw Normal View History

2021-02-28 12:40:42 +13:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
2021-02-28 12:40:42 +13:00
import praw
import pytest
2021-04-12 19:58:32 +12:00
from bdfr.resource import Resource
from bdfr.site_downloaders.self_post import SelfPost
2021-02-28 12:40:42 +13:00
@pytest.mark.online
@pytest.mark.reddit
2022-12-03 18:11:17 +13:00
@pytest.mark.parametrize(
("test_submission_id", "expected_hash"),
(
("ltmivt", "7d2c9e4e989e5cf2dca2e55a06b1c4f6"),
("ltoaan", "221606386b614d6780c2585a59bd333f"),
("d3sc8o", "c1ff2b6bd3f6b91381dcd18dfc4ca35f"),
),
)
2021-02-28 12:40:42 +13:00
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