1
0
Fork 0
mirror of synced 2024-05-23 13:39:49 +12:00

Add test for unauthenticated instances

This commit is contained in:
Serene-Arc 2021-07-02 14:29:39 +10:00
parent c4aa617737
commit 8db9d0bcc4
2 changed files with 4 additions and 0 deletions

View file

@ -242,6 +242,9 @@ class RedditConnector(metaclass=ABCMeta):
if self.args.subreddit:
out = []
for reddit in self.split_args_input(self.args.subreddit):
if reddit == 'friends' and self.authenticated is False:
logger.error('Cannot read friends subreddit without an authenticated instance')
continue
try:
reddit = self.reddit_instance.subreddit(reddit)
try:

View file

@ -214,6 +214,7 @@ def test_cli_download_long(test_args: list[str], tmp_path: Path):
['--subreddit', 'submitters', '-L', 10], # Private subreddit
['--subreddit', 'donaldtrump', '-L', 10], # Banned subreddit
['--user', 'djnish', '--user', 'helen_darten', '-m', 'cuteanimalpics', '-L', 10],
['--subreddit', 'friends', '-L', 10],
))
def test_cli_download_soft_fail(test_args: list[str], tmp_path: Path):
runner = CliRunner()