2025-01-14 15:28:39 +00:00
|
|
|
import pytest
|
|
|
|
|
2025-01-07 18:43:20 +00:00
|
|
|
from auto_archiver.core import Metadata
|
2025-01-14 15:28:39 +00:00
|
|
|
from auto_archiver.core import Step
|
2025-01-13 13:31:29 +00:00
|
|
|
from auto_archiver.core.metadata import Metadata
|
2025-01-20 15:17:57 +00:00
|
|
|
from auto_archiver.archivers.archiver import Archiver
|
2025-01-07 18:43:20 +00:00
|
|
|
class TestArchiverBase(object):
|
|
|
|
|
2025-01-20 15:17:57 +00:00
|
|
|
archiver_class: str = None
|
|
|
|
config: dict = None
|
2025-01-07 18:43:20 +00:00
|
|
|
|
2025-01-14 15:28:39 +00:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def setup_archiver(self):
|
2025-01-07 18:43:20 +00:00
|
|
|
assert self.archiver_class is not None, "self.archiver_class must be set on the subclass"
|
|
|
|
assert self.config is not None, "self.config must be a dict set on the subclass"
|
2025-01-20 15:17:57 +00:00
|
|
|
self.archiver: Archiver = self.archiver_class({self.archiver_class.name: self.config})
|
2025-01-07 18:43:20 +00:00
|
|
|
|
2025-01-13 13:31:29 +00:00
|
|
|
def assertValidResponseMetadata(self, test_response: Metadata, title: str, timestamp: str, status: str = ""):
|
|
|
|
assert test_response is not False
|
|
|
|
|
|
|
|
if not status:
|
|
|
|
assert test_response.is_success()
|
|
|
|
else:
|
|
|
|
assert status == test_response.status
|
|
|
|
|
2025-01-13 12:15:13 +00:00
|
|
|
assert title == test_response.get_title()
|
|
|
|
assert timestamp, test_response.get("timestamp")
|