fix: opt draft storage into real callers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
@@ -21,6 +22,33 @@ from wf_transport_rpc_http.models import (
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _draft_enabled_composition(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Opt draft-focused RPC tests into the otherwise disabled composition."""
|
||||
build_local = build_local_static_workflow_server
|
||||
build_config = build_workflow_server_from_workflow_config
|
||||
create_app = create_rpc_app
|
||||
|
||||
def draft_local(root, *args, **kwargs):
|
||||
kwargs.setdefault("drafts", True)
|
||||
return build_local(root, *args, **kwargs)
|
||||
|
||||
def draft_config(config, *args, **kwargs):
|
||||
kwargs.setdefault("drafts", True)
|
||||
return build_config(config, *args, **kwargs)
|
||||
|
||||
def draft_app(server, *args, **kwargs):
|
||||
kwargs.setdefault("drafts", True)
|
||||
return create_app(server, *args, **kwargs)
|
||||
|
||||
module = sys.modules[__name__]
|
||||
monkeypatch.setattr(module, "build_local_static_workflow_server", draft_local)
|
||||
monkeypatch.setattr(
|
||||
module, "build_workflow_server_from_workflow_config", draft_config
|
||||
)
|
||||
monkeypatch.setattr(module, "create_rpc_app", draft_app)
|
||||
|
||||
|
||||
async def _rpc(
|
||||
client: httpx.AsyncClient, method: str, params: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
@@ -31,6 +32,25 @@ from wf_transport_rpc_http.client.drafts import RpcDraftClientMixin
|
||||
from wf_transport_rpc_http.client.sources import RpcSourceAdminClientMixin
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _draft_enabled_composition(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Opt draft-focused RPC client tests into the explicit draft surface."""
|
||||
build_local = build_local_static_workflow_server
|
||||
create_app = create_rpc_app
|
||||
|
||||
def draft_local(root, *args, **kwargs):
|
||||
kwargs.setdefault("drafts", True)
|
||||
return build_local(root, *args, **kwargs)
|
||||
|
||||
def draft_app(server, *args, **kwargs):
|
||||
kwargs.setdefault("drafts", True)
|
||||
return create_app(server, *args, **kwargs)
|
||||
|
||||
module = sys.modules[__name__]
|
||||
monkeypatch.setattr(module, "build_local_static_workflow_server", draft_local)
|
||||
monkeypatch.setattr(module, "create_rpc_app", draft_app)
|
||||
|
||||
|
||||
async def test_rpc_client_preserves_structured_jsonrpc_error() -> None:
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
|
||||
@@ -31,7 +31,12 @@ def _assert_result_component(
|
||||
|
||||
@pytest.fixture
|
||||
def openrpc_document(tmp_path: Path) -> dict[str, Any]:
|
||||
app = create_rpc_app(build_local_static_workflow_server(tmp_path / "store"))
|
||||
# This fixture inventories the complete RPC contract, including the
|
||||
# explicitly opt-in draft methods.
|
||||
app = create_rpc_app(
|
||||
build_local_static_workflow_server(tmp_path / "store", drafts=True),
|
||||
drafts=True,
|
||||
)
|
||||
return app.get_openrpc()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user