commit
900f9a93ee
|
@ -65,11 +65,11 @@ def test_get_data_album(test_url: str, expected_gen_dict: dict, expected_image_d
|
||||||
{'hash': 'dLk3FGY', 'title': '', 'ext': '.mp4', 'animated': True}
|
{'hash': 'dLk3FGY', 'title': '', 'ext': '.mp4', 'animated': True}
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'https://imgur.com/BuzvZwb.gifv',
|
'https://imgur.com/65FqTpT.gifv',
|
||||||
{
|
{
|
||||||
'hash': 'BuzvZwb',
|
'hash': '65FqTpT',
|
||||||
'title': '',
|
'title': '',
|
||||||
'description': 'Akron Glass Works',
|
'description': '',
|
||||||
'animated': True,
|
'animated': True,
|
||||||
'mimetype': 'video/mp4'
|
'mimetype': 'video/mp4'
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,6 +45,15 @@ def assert_all_results_are_submissions(result_limit: int, results: list[Iterator
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def assert_all_results_are_submissions_or_comments(result_limit: int, results: list[Iterator]) -> list:
|
||||||
|
results = [sub for res in results for sub in res]
|
||||||
|
assert all([isinstance(res, praw.models.Submission) or isinstance(res, praw.models.Comment) for res in results])
|
||||||
|
assert not any([isinstance(m, MagicMock) for m in results])
|
||||||
|
if result_limit is not None:
|
||||||
|
assert len(results) == result_limit
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def test_determine_directories(tmp_path: Path, downloader_mock: MagicMock):
|
def test_determine_directories(tmp_path: Path, downloader_mock: MagicMock):
|
||||||
downloader_mock.args.directory = tmp_path / 'test'
|
downloader_mock.args.directory = tmp_path / 'test'
|
||||||
downloader_mock.config_directories.user_config_dir = tmp_path
|
downloader_mock.config_directories.user_config_dir = tmp_path
|
||||||
|
@ -297,7 +306,7 @@ def test_get_user_authenticated_lists(
|
||||||
downloader_mock.sort_filter = RedditTypes.SortType.HOT
|
downloader_mock.sort_filter = RedditTypes.SortType.HOT
|
||||||
downloader_mock.args.user = [RedditConnector.resolve_user_name(downloader_mock, 'me')]
|
downloader_mock.args.user = [RedditConnector.resolve_user_name(downloader_mock, 'me')]
|
||||||
results = RedditConnector.get_user_data(downloader_mock)
|
results = RedditConnector.get_user_data(downloader_mock)
|
||||||
assert_all_results_are_submissions(10, results)
|
assert_all_results_are_submissions_or_comments(10, results)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(('test_name', 'expected'), (
|
@pytest.mark.parametrize(('test_name', 'expected'), (
|
||||||
|
|
Loading…
Reference in a new issue