Catch errors for banned or private subreddits
This commit is contained in:
@@ -505,3 +505,15 @@ def test_check_user_existence_banned(
|
||||
downloader_mock.reddit_instance = reddit_instance
|
||||
with pytest.raises(BulkDownloaderException, match='is banned'):
|
||||
RedditDownloader._check_user_existence(downloader_mock, test_redditor_name)
|
||||
|
||||
|
||||
@pytest.mark.online
|
||||
@pytest.mark.reddit
|
||||
@pytest.mark.parametrize(('test_subreddit_name', 'expected_message'), (
|
||||
('donaldtrump', 'cannot be found'),
|
||||
('submitters', 'private and cannot be scraped')
|
||||
))
|
||||
def test_check_subreddit_status(test_subreddit_name: str, expected_message: str, reddit_instance: praw.Reddit):
|
||||
test_subreddit = reddit_instance.subreddit(test_subreddit_name)
|
||||
with pytest.raises(BulkDownloaderException, match=expected_message):
|
||||
RedditDownloader._check_subreddit_status(test_subreddit)
|
||||
|
||||
Reference in New Issue
Block a user