Move scope regex parsing

This commit is contained in:
Serene-Arc
2021-03-08 12:34:03 +10:00
committed by Ali Parlakci
parent dd1831b0ea
commit 7c2b7b0e83
2 changed files with 18 additions and 2 deletions

View File

@@ -4,7 +4,6 @@
import configparser
from unittest.mock import MagicMock
import praw
import pytest
from bulkredditdownloader.exceptions import BulkDownloaderException
@@ -30,6 +29,17 @@ def test_check_scopes(test_scopes: list[str]):
OAuth2Authenticator._check_scopes(test_scopes)
@pytest.mark.parametrize(('test_scopes', 'expected'), (
('history', {'history', }),
('history creddits', {'history', 'creddits'}),
('history, creddits, account', {'history', 'creddits', 'account'}),
('history,creddits,account,flair', {'history', 'creddits', 'account', 'flair'}),
))
def test_split_scopes(test_scopes: str, expected: set[str]):
result = OAuth2Authenticator.split_scopes(test_scopes)
assert result == expected
@pytest.mark.online
@pytest.mark.parametrize('test_scopes', (
('random',),