mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
Merge pull request #261 from bellingcat/wacz_separate_profile
Wacz minor adjustments
This commit is contained in:
@@ -4,6 +4,7 @@ from zipfile import ZipFile
|
||||
import pytest
|
||||
|
||||
from auto_archiver.core import Metadata, Media
|
||||
from auto_archiver.core.consts import SetupError
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -22,6 +23,15 @@ def wacz_enricher(setup_module, mock_binary_dependencies):
|
||||
return wacz
|
||||
|
||||
|
||||
def test_raises_error_without_docker_installed(setup_module, mocker, caplog):
|
||||
# pretend that docker isn't installed
|
||||
mocker.patch("shutil.which").return_value = None
|
||||
with pytest.raises(SetupError):
|
||||
setup_module("wacz_extractor_enricher", {})
|
||||
|
||||
assert "requires external dependency 'docker' which is not available/setup" in caplog.text
|
||||
|
||||
|
||||
def test_setup_without_docker(wacz_enricher, mocker):
|
||||
mocker.patch.dict(os.environ, {"RUNNING_IN_DOCKER": "1"}, clear=True)
|
||||
wacz_enricher.setup()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
from auto_archiver.core.module import ModuleFactory, LazyBaseModule
|
||||
from auto_archiver.core.base_module import BaseModule
|
||||
from auto_archiver.core.consts import SetupError
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -25,11 +26,9 @@ def test_python_dependency_check(example_module):
|
||||
# monkey patch the manifest to include a nonexistnet dependency
|
||||
example_module.manifest["dependencies"]["python"] = ["does_not_exist"]
|
||||
|
||||
with pytest.raises(SystemExit) as load_error:
|
||||
with pytest.raises(SetupError):
|
||||
example_module.load({})
|
||||
|
||||
assert load_error.value.code == 1
|
||||
|
||||
|
||||
def test_binary_dependency_check(example_module):
|
||||
# example_module requires ffmpeg, which is not installed
|
||||
|
||||
Reference in New Issue
Block a user