mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-26 06:57:59 +01:00
65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
|
"""
|
||
|
Stamper tests.
|
||
|
"""
|
||
|
|
||
|
|
||
|
#
|
||
|
# Fimfarchive, preserves stories from Fimfiction.
|
||
|
# Copyright (C) 2015 Joakim Soderlund
|
||
|
#
|
||
|
# This program is free software: you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation, either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
#
|
||
|
|
||
|
|
||
|
from typing import Dict
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from fimfarchive.stampers import Stamper
|
||
|
|
||
|
|
||
|
class TestStamper:
|
||
|
"""
|
||
|
Stamper tests.
|
||
|
"""
|
||
|
|
||
|
@pytest.fixture
|
||
|
def stamper(self):
|
||
|
"""
|
||
|
Returns a new stamper instance.
|
||
|
"""
|
||
|
return Stamper()
|
||
|
|
||
|
def test_missing_archive_dict(self, stamper, story):
|
||
|
"""
|
||
|
Tests archive dict is created if none exists.
|
||
|
"""
|
||
|
meta = story.meta
|
||
|
assert 'archive' not in meta
|
||
|
|
||
|
archive = stamper.get_archive(story)
|
||
|
assert meta['archive'] is archive
|
||
|
|
||
|
def test_existing_archive_dict(self, stamper, story):
|
||
|
"""
|
||
|
Tests archive dict is kept if it exists.
|
||
|
"""
|
||
|
meta = story.meta
|
||
|
original: Dict = dict()
|
||
|
meta['archive'] = original
|
||
|
archive = stamper.get_archive(story)
|
||
|
|
||
|
assert archive is original
|
||
|
assert meta['archive'] is original
|