Add test for site downloader gallery

This commit is contained in:
Serene-Arc
2021-02-15 17:45:41 +10:00
committed by Ali Parlakci
parent 1b40b16970
commit bb85fb8934
2 changed files with 26 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python3
# coding=utf-8
import praw
import praw.models
import pytest
from bulkredditdownloader.resource import Resource
from bulkredditdownloader.site_downloaders.gallery import Gallery
@pytest.fixture()
def reddit_submission() -> praw.models.Submission:
rd = praw.Reddit(client_id='U-6gk4ZCh3IeNQ', client_secret='7CZHY6AmKweZME5s50SfDGylaPg', user_agent='test')
return rd.submission(id='ljyy27')
def test_gallery(reddit_submission: praw.models.Submission):
gallery = Gallery(reddit_submission)
results = gallery.download()
assert len(results) == 4
assert all([isinstance(result, Resource) for result in results])