diff --git a/modules/archive/conftest.py b/modules/archive/conftest.py index ddc3e987..6c2e8f37 100644 --- a/modules/archive/conftest.py +++ b/modules/archive/conftest.py @@ -1,3 +1,4 @@ +import copy import datetime import json import pathlib @@ -84,3 +85,28 @@ def archive_factory(test_session, archive_directory, make_files_structure): return archive return _ + + +SINGLEFILE_CONTENTS = ''' + + + + +the title + + +some body contents + + + +''' + + +@pytest.fixture +def singlefile_contents() -> str: + """Return a short HTML string that contains an example Singlefile file.""" + return copy.deepcopy(SINGLEFILE_CONTENTS) diff --git a/modules/archive/lib.py b/modules/archive/lib.py index 2e7a6077..453828ea 100644 --- a/modules/archive/lib.py +++ b/modules/archive/lib.py @@ -488,13 +488,29 @@ def is_archive_file(path: pathlib.Path) -> bool: return path.is_file() and path.suffix.lower() in ARCHIVE_SUFFIXES and bool(ARCHIVE_MATCHER.match(path.name)) +SINGLEFILE_HEADER = '''