Add beginning of archiver
This commit is contained in:
36
bulkredditdownloader/tests/test_archiver.py
Normal file
36
bulkredditdownloader/tests/test_archiver.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
# coding=utf-8
|
||||
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import praw
|
||||
import pytest
|
||||
|
||||
from bulkredditdownloader.archive_entry import ArchiveEntry
|
||||
from bulkredditdownloader.archiver import Archiver
|
||||
|
||||
|
||||
@pytest.mark.online
|
||||
@pytest.mark.reddit
|
||||
@pytest.mark.parametrize('test_submission_id', (
|
||||
'm3reby',
|
||||
))
|
||||
def test_write_submission_json(test_submission_id: str, tmp_path: Path, reddit_instance: praw.Reddit):
|
||||
archiver_mock = MagicMock()
|
||||
test_path = Path(tmp_path, 'test.json')
|
||||
test_submission = reddit_instance.submission(id=test_submission_id)
|
||||
archiver_mock.file_name_formatter.format_path.return_value = test_path
|
||||
test_entry = ArchiveEntry(test_submission)
|
||||
Archiver._write_submission_json(archiver_mock, test_entry)
|
||||
assert test_path.exists()
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_write_submission_xml():
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_write_submission_yaml():
|
||||
raise NotImplementedError
|
||||
Reference in New Issue
Block a user