mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-08 03:18:28 +03:00
Ruff format with defaults.
This commit is contained in:
@@ -10,21 +10,23 @@ def orchestration_file_path(tmp_path):
|
||||
folder.mkdir(exist_ok=True)
|
||||
return (folder / "example_orch.yaml").as_posix()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def orchestration_file(orchestration_file_path):
|
||||
def _orchestration_file(content=''):
|
||||
def _orchestration_file(content=""):
|
||||
with open(orchestration_file_path, "w") as f:
|
||||
f.write(content)
|
||||
return orchestration_file_path
|
||||
|
||||
|
||||
return _orchestration_file
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def autoarchiver(tmp_path, monkeypatch, request):
|
||||
def _autoarchiver(args=[]):
|
||||
|
||||
def cleanup():
|
||||
from loguru import logger
|
||||
|
||||
if not logger._core.handlers.get(0):
|
||||
logger._core.handlers_count = 0
|
||||
logger.add(sys.stderr)
|
||||
@@ -47,6 +49,7 @@ def test_run_auto_archiver_no_args(caplog, autoarchiver):
|
||||
|
||||
assert "provide at least one URL via the command line, or set up an alternative feeder" in caplog.text
|
||||
|
||||
|
||||
def test_run_auto_archiver_invalid_file(caplog, autoarchiver):
|
||||
# exec 'auto-archiver' on the command lin
|
||||
with pytest.raises(SystemExit):
|
||||
@@ -54,6 +57,7 @@ def test_run_auto_archiver_invalid_file(caplog, autoarchiver):
|
||||
|
||||
assert "Make sure the file exists and try again, or run without th" in caplog.text
|
||||
|
||||
|
||||
def test_run_auto_archiver_empty_file(caplog, autoarchiver, orchestration_file):
|
||||
# create a valid (empty) orchestration file
|
||||
path = orchestration_file(content="")
|
||||
@@ -64,6 +68,7 @@ def test_run_auto_archiver_empty_file(caplog, autoarchiver, orchestration_file):
|
||||
# should treat an empty file as if there is no file at all
|
||||
assert " No URLs provided. Please provide at least one URL via the com" in caplog.text
|
||||
|
||||
|
||||
def test_call_autoarchiver_main(caplog, monkeypatch, tmp_path):
|
||||
from auto_archiver.__main__ import main
|
||||
|
||||
@@ -75,4 +80,4 @@ def test_call_autoarchiver_main(caplog, monkeypatch, tmp_path):
|
||||
with pytest.raises(SystemExit):
|
||||
main()
|
||||
|
||||
assert "No URLs provided. Please provide at least one" in caplog.text
|
||||
assert "No URLs provided. Please provide at least one" in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user