1
0
Fork 0
mirror of synced 2024-05-18 03:02:48 +12:00
bulk-downloader-for-reddit/tests/test_archiver.py
OMEGARAZER 83f45e7f60
Standardize shebang and coding declaration
Standardizes shebang and coding declarations.

Coding matches what's used by install tools such as pip(x).

Removes a few init files that were not needed.
2022-12-19 18:32:37 -05:00

30 lines
821 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
from unittest.mock import MagicMock
import praw
import pytest
from bdfr.archiver import Archiver
@pytest.mark.online
@pytest.mark.reddit
@pytest.mark.parametrize(
("test_submission_id", "test_format"),
(
("m3reby", "xml"),
("m3reby", "json"),
("m3reby", "yaml"),
),
)
def test_write_submission_json(test_submission_id: str, tmp_path: Path, test_format: str, reddit_instance: praw.Reddit):
archiver_mock = MagicMock()
archiver_mock.args.format = test_format
test_path = Path(tmp_path, "test")
test_submission = reddit_instance.submission(id=test_submission_id)
archiver_mock.file_name_formatter.format_path.return_value = test_path
Archiver.write_entry(archiver_mock, test_submission)