refactor-1

This commit is contained in:
2026-03-15 21:46:50 +02:00
parent 24d682adf1
commit c0b378c424
25 changed files with 4839 additions and 3136 deletions

View File

@@ -62,12 +62,12 @@ def test_resolve_package_manager_explicit_value(ctx):
def test_resolve_package_manager_linux_auto_apt(monkeypatch, ctx):
monkeypatch.setattr("flow.commands.bootstrap.shutil.which", lambda name: "/usr/bin/apt" if name == "apt" else None)
monkeypatch.setattr("flow.services.bootstrap.shutil.which", lambda name: "/usr/bin/apt" if name == "apt" else None)
assert _resolve_package_manager(ctx, {"os": "linux"}) == "apt"
def test_resolve_package_manager_linux_auto_dnf(monkeypatch, ctx):
monkeypatch.setattr("flow.commands.bootstrap.shutil.which", lambda name: "/usr/bin/dnf" if name == "dnf" else None)
monkeypatch.setattr("flow.services.bootstrap.shutil.which", lambda name: "/usr/bin/dnf" if name == "dnf" else None)
assert _resolve_package_manager(ctx, {"os": "linux"}) == "dnf"
@@ -158,7 +158,7 @@ class _FakeResponse:
def _patch_binary_download(monkeypatch, after_unpack=None):
monkeypatch.setattr(
"flow.commands.bootstrap.urllib.request.urlopen",
"flow.services.bootstrap.urllib.request.urlopen",
lambda *args, **kwargs: _FakeResponse(),
)
@@ -168,7 +168,7 @@ def _patch_binary_download(monkeypatch, after_unpack=None):
if after_unpack:
after_unpack(extracted)
monkeypatch.setattr("flow.commands.bootstrap.shutil.unpack_archive", _fake_unpack)
monkeypatch.setattr("flow.services.bootstrap.shutil.unpack_archive", _fake_unpack)
def test_install_binary_package_rejects_absolute_declared_path(monkeypatch, tmp_path, ctx):
@@ -177,7 +177,7 @@ def test_install_binary_package_rejects_absolute_declared_path(monkeypatch, tmp_
_patch_binary_download(monkeypatch)
monkeypatch.setattr(
"flow.commands.bootstrap._copy_install_item",
"flow.services.bootstrap._copy_install_item",
lambda *args, **kwargs: pytest.fail("_copy_install_item should not be called"),
)
@@ -199,7 +199,7 @@ def test_install_binary_package_rejects_parent_traversal_declared_path(monkeypat
_patch_binary_download(monkeypatch, after_unpack=_after_unpack)
monkeypatch.setattr(
"flow.commands.bootstrap._copy_install_item",
"flow.services.bootstrap._copy_install_item",
lambda *args, **kwargs: pytest.fail("_copy_install_item should not be called"),
)