ExMcp.Test.Support.Transports (ex_mcp v0.10.0)
View SourceTest support module for transport-related testing utilities.
This module provides helpers for testing different transport mechanisms used in ExMCP, including HTTP, stdio, and BEAM transports. It includes mock transport implementations and utilities for testing transport behavior.
Summary
Functions
Creates a transport message in the expected format.
Simulates a transport connection for testing.
Creates transport headers for HTTP testing.
Creates a mock transport configuration for testing.
Simulates transport errors for testing error handling.
Creates a mock transport process for testing.
Validates transport configuration for testing.
Functions
Creates a transport message in the expected format.
Formats messages according to the transport protocol specifications for use in testing scenarios.
Simulates a transport connection for testing.
This function creates a mock connection that can be used in tests to verify transport behavior without external dependencies.
Creates transport headers for HTTP testing.
Generates appropriate headers for different HTTP test scenarios, including authentication headers and content type headers.
Creates a mock transport configuration for testing.
Parameters
transport_type- The type of transport (:http, :stdio, :beam, :test)opts- Additional options for the transport
Returns
A transport configuration map suitable for testing.
Simulates transport errors for testing error handling.
Creates various error scenarios that can occur during transport operations to test error handling and recovery mechanisms.
Creates a mock transport process for testing.
This creates a GenServer process that simulates transport behavior for testing purposes without requiring actual network connections.
Validates transport configuration for testing.
Ensures that transport configurations are valid and contain required fields for testing scenarios.