CodexEx.AppServer.MockTransport (codex_ex v0.1.0)

Copy Markdown View Source

In-process mock of the Codex app-server protocol for testing.

Implements the Transport behaviour as a GenServer. Each test starts its own isolated instance — no shared state, no Python dependency, async-safe.

Usage modes

Explicit (unit tests):

{:ok, mock} = MockTransport.start_link()
MockTransport.configure(mock, server_request: true)
client = start_supervised!({Client, [transport: MockTransport, mock_pid: mock]})

Auto-start (LiveView tests via launcher settings):

# Runner settings: %{"launcher" => %{"transport" => "mock"}}
# MockTransport.open/1 starts its own GenServer when no mock_pid is provided.

Summary

Functions

Returns a specification to start this module under a supervisor.

Configure mock behavior for the next operation. Turn-specific flags are one-shot.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

configure(mock, opts)

Configure mock behavior for the next operation. Turn-specific flags are one-shot.

start_link(opts \\ [])