ExUtcp.Transports.TcpUdp.Testable (ex_utcp v0.3.2)

Copy Markdown View Source

Testable module for TCP/UDP transport to enable mocking in tests.

This module provides a way to inject mocks for the TCP/UDP transport components during testing, allowing for isolated unit tests.

Summary

Functions

Clears all mocks.

Creates a mock connection for testing.

Creates a mock pool for testing.

Creates a test TCP provider.

Creates a test tool.

Creates a test UDP provider.

Gets the mock module for connections.

Gets the mock module for pools.

Mocks a connection error.

Mocks a pool error.

Sets the mock modules for testing.

Validates a TCP provider configuration.

Validates a UDP provider configuration.

Functions

clear_mocks()

Clears all mocks.

create_mock_connection(provider)

Creates a mock connection for testing.

create_mock_pool(opts \\ [])

Creates a mock pool for testing.

create_test_tcp_provider(opts \\ [])

Creates a test TCP provider.

create_test_tool(opts \\ [])

Creates a test tool.

create_test_udp_provider(opts \\ [])

Creates a test UDP provider.

get_connection_mock()

Gets the mock module for connections.

get_pool_mock()

Gets the mock module for pools.

mock_connection_error(reason)

Mocks a connection error.

mock_pool_error(reason)

Mocks a pool error.

mock_tool_call_response(tool_name, args, response)

Mocks a tool call response.

mock_tool_stream_response(tool_name, args, stream_data)

Mocks a tool stream response.

set_mocks(connection_behaviour, pool_behaviour)

Sets the mock modules for testing.

validate_tcp_provider(provider)

Validates a TCP provider configuration.

validate_udp_provider(provider)

Validates a UDP provider configuration.