Skip to content

Commit

Permalink
Merge pull request #633 from chapmanjacobd/patch-3
Browse files Browse the repository at this point in the history
fix: Redirect to /subreddits/search
  • Loading branch information
Serene-Arc authored Jul 17, 2022
2 parents 59e57ce + 7100291 commit 8ab13b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bdfr/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ def check_subreddit_status(subreddit: praw.models.Subreddit):
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')

Expand Down
3 changes: 2 additions & 1 deletion tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8ab13b4

Please sign in to comment.