Move Makefile and fix import error with unused import.

pull/244/head
erinhmclark 2025-03-11 19:58:02 +00:00
rodzic 28c5396b74
commit 8ca7698fa0
3 zmienionych plików z 21 dodań i 3 usunięć

Wyświetl plik

@ -5,8 +5,8 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = _build
SOURCEDIR = docs/source
BUILDDIR = docs/_build
# Put it first so that "make" without argument is like "make help".
help:

Wyświetl plik

@ -30,6 +30,7 @@ from slugify import slugify
from auto_archiver.utils.misc import random_str
from auto_archiver.core import Media, BaseModule, Metadata
from auto_archiver.modules.hash_enricher.hash_enricher import HashEnricher
class Storage(BaseModule):

Wyświetl plik

@ -92,4 +92,21 @@ def test_really_long_name(storage_base, dummy_file):
url = f"https://example.com/{'file'*100}"
media = Media(filename=dummy_file)
storage.set_key(media, url, Metadata())
assert media.key == f"https-example-com-{'file'*13}/6ae8a75555209fd6c44157c0.txt"
assert media.key == f"https-example-com-{'file'*13}/6ae8a75555209fd6c44157c0.txt"
def test_storage_loads_hash_enricher(storage_base, dummy_file):
"""Ensure 'hash_enricher' is properly loaded without an explicit import."""
config = {"path_generator": "url", "filename_generator": "static"}
storage = storage_base(config)
url = "https://example.com/file/"
media = Media(filename=dummy_file)
metadata = Metadata()
try:
storage.set_key(media, url, metadata)
except Exception as e:
pytest.fail(f"Storage failed to dynamically load hash_enricher: {e}")
assert media.key is not None, "Expected media.key to be set, but it was None"