(
tmp_path: Path,
monkeypatch: Any,
*,
name: str = "g",
endpoint: str = "http://127.0.0.1:8080",
auth_mode: str | None = None,
mtls_files: dict[str, str] | None = None,
oidc_bundle: dict | None = None,
)
| 296 | |
| 297 | |
| 298 | def _setup_gateway_dir( |
| 299 | tmp_path: Path, |
| 300 | monkeypatch: Any, |
| 301 | *, |
| 302 | name: str = "g", |
| 303 | endpoint: str = "http://127.0.0.1:8080", |
| 304 | auth_mode: str | None = None, |
| 305 | mtls_files: dict[str, str] | None = None, |
| 306 | oidc_bundle: dict | None = None, |
| 307 | ) -> Path: |
| 308 | gateway_dir = tmp_path / "openshell" / "gateways" / name |
| 309 | gateway_dir.mkdir(parents=True) |
| 310 | (tmp_path / "openshell" / "active_gateway").write_text(name) |
| 311 | meta: dict[str, Any] = {"gateway_endpoint": endpoint} |
| 312 | if auth_mode is not None: |
| 313 | meta["auth_mode"] = auth_mode |
| 314 | (gateway_dir / "metadata.json").write_text(json.dumps(meta)) |
| 315 | if mtls_files: |
| 316 | mtls_dir = gateway_dir / "mtls" |
| 317 | mtls_dir.mkdir() |
| 318 | for fname, body in mtls_files.items(): |
| 319 | (mtls_dir / fname).write_text(body) |
| 320 | if oidc_bundle is not None: |
| 321 | (gateway_dir / "oidc_token.json").write_text(json.dumps(oidc_bundle)) |
| 322 | monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path)) |
| 323 | monkeypatch.delenv("OPENSHELL_GATEWAY", raising=False) |
| 324 | return gateway_dir |
| 325 | |
| 326 | |
| 327 | def _channel_is_intercepted(channel: Any) -> bool: |
no outgoing calls
no test coverage detected