kopia lustrzana https://github.com/bellingcat/auto-archiver
Move Makefile and fix import error with unused import.
rodzic
28c5396b74
commit
8ca7698fa0
|
@ -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:
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Ładowanie…
Reference in New Issue