1
0
Fork 0
mirror of synced 2024-05-21 12:42:44 +12:00

Merge pull request #633 from chapmanjacobd/patch-3

fix: Redirect to /subreddits/search
This commit is contained in:
Serene 2022-07-17 11:17:52 +10:00 committed by GitHub
commit 8ab13b4480
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -414,7 +414,9 @@ class RedditConnector(metaclass=ABCMeta):
try:
assert subreddit.id
except prawcore.NotFound:
raise errors.BulkDownloaderException(f'Source {subreddit.display_name} does not exist or cannot be found')
raise errors.BulkDownloaderException(f"Source {subreddit.display_name} cannot be found")
except prawcore.Redirect:
raise errors.BulkDownloaderException(f"Source {subreddit.display_name} does not exist")
except prawcore.Forbidden:
raise errors.BulkDownloaderException(f'Source {subreddit.display_name} is private and cannot be scraped')

View file

@ -447,7 +447,8 @@ def test_check_user_existence_banned(
@pytest.mark.reddit
@pytest.mark.parametrize(('test_subreddit_name', 'expected_message'), (
('donaldtrump', 'cannot be found'),
('submitters', 'private and cannot be scraped')
('submitters', 'private and cannot be scraped'),
('lhnhfkuhwreolo', 'does not exist')
))
def test_check_subreddit_status_bad(test_subreddit_name: str, expected_message: str, reddit_instance: praw.Reddit):
test_subreddit = reddit_instance.subreddit(test_subreddit_name)