Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(tests): update stale router and queue test doubles

joshistoast83b7c70baf95
diff --git a/tests/app/routers/test_app_info.py b/tests/app/routers/test_app_info.py
index da493cee45..94b46b2f2e 100644
--- a/tests/app/routers/test_app_info.py
+++ b/tests/app/routers/test_app_info.py
@@ -38,6 +38,7 @@ def test_get_external_provider_statuses(monkeypatch: Any, mock_invoker: Invoker,
}
monkeypatch.setattr("invokeai.app.api.routers.app_info.ApiDependencies", MockApiDependencies(mock_invoker))
+ monkeypatch.setattr("invokeai.app.api.auth_dependencies.ApiDependencies", MockApiDependencies(mock_invoker))
monkeypatch.setattr(mock_invoker.services.external_generation, "get_provider_statuses", lambda: statuses)
response = client.get("/api/v1/app/external_providers/status")
diff --git a/tests/app/routers/test_multiuser_authorization.py b/tests/app/routers/test_multiuser_authorization.py
index 7d2df5777f..e236be2cd2 100644
--- a/tests/app/routers/test_multiuser_authorization.py
+++ b/tests/app/routers/test_multiuser_authorization.py
@@ -1952,15 +1952,13 @@ class TestCustomNodesAuthorization:
monkeypatch.setattr("invokeai.app.api.routers.custom_nodes._get_custom_nodes_path", lambda: tmp_path)
# Simulate a successful git clone by creating the target dir with __init__.py
- def fake_git_clone(cmd: list[str], **kwargs: Any) -> MagicMock:
+ async def fake_clone_node_pack(source: str, target_dir: Any) -> tuple[int, str]:
target_dir = tmp_path / "test-pack"
target_dir.mkdir(parents=True, exist_ok=True)
(target_dir / "__init__.py").touch()
- result = MagicMock()
- result.returncode = 0
- return result
+ return 0, ""
- monkeypatch.setattr("invokeai.app.api.routers.custom_nodes.subprocess.run", fake_git_clone)
+ monkeypatch.setattr("invokeai.app.api.routers.custom_nodes._clone_node_pack", fake_clone_node_pack)
monkeypatch.setattr("invokeai.app.api.routers.custom_nodes._load_node_pack", lambda *a, **kw: None)
monkeypatch.setattr("invokeai.app.api.routers.custom_nodes._import_workflows_from_pack", lambda *a, **kw: [])
monkeypatch.setattr("invokeai.app.api.routers.custom_nodes._write_pack_manifest", lambda *a, **kw: None)
diff --git a/tests/app/services/session_queue/test_session_queue_status_event_isolation.py b/tests/app/services/session_queue/test_session_queue_status_event_isolation.py
index af7fdd8931..196f414144 100644
--- a/tests/app/services/session_queue/test_session_queue_status_event_isolation.py
+++ b/tests/app/services/session_queue/test_session_queue_status_event_isolation.py
@@ -157,7 +157,7 @@ def test_event_redacts_when_current_item_disappears_between_reads(
# item; the redaction read returns None as if B finished in between.
call_count = {"n": 0}
- def racey_get_current(queue_id: str) -> Optional[SessionQueueItem]:
+ def racey_get_current(queue_id: str, origin_prefix: Optional[str] = None) -> Optional[SessionQueueItem]:
call_count["n"] += 1
if call_count["n"] == 1:
return b_snapshot