apiutils

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package apiutils implements the api test utils.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestGRPCGatewayAPIClient added in v1.0.0

func NewTestGRPCGatewayAPIClient(
	t *testing.T,
	addr string,
	extraDialOpts ...connect.ClientOption,
) payer_apiconnect.PayerApiClient

func NewTestGRPCMetadataAPIClient added in v1.0.0

func NewTestGRPCMetadataAPIClient(
	t *testing.T,
	addr string,
	extraDialOpts ...connect.ClientOption,
) metadata_apiconnect.MetadataApiClient

func NewTestGRPCReplicationAPIClient added in v1.0.0

func NewTestGRPCReplicationAPIClient(
	t *testing.T,
	addr string,
	extraDialOpts ...connect.ClientOption,
) message_apiconnect.ReplicationApiClient

Types

type APIServerMocks added in v0.5.1

type APIServerMocks struct {
	MockRegistry          *mocks.MockNodeRegistry
	MockValidationService *mlsvalidateMocks.MockMLSValidationService
	MockMessagePublisher  *blockchain.MockIBlockchainPublisher
}

type APIServerTestConfig added in v1.1.0

type APIServerTestConfig struct {
	// contains filtered or unexported fields
}

APIServerTestConfig allows explicitly setting some components used for tests.

type APIServerTestSuite added in v1.0.0

type APIServerTestSuite struct {
	APIServer         *api.APIServer
	ClientReplication message_apiconnect.ReplicationApiClient
	ClientPayer       payer_apiconnect.PayerApiClient
	ClientMetadata    metadata_apiconnect.MetadataApiClient
	DB                *sql.DB
	APIServerMocks    APIServerMocks
}

func NewTestAPIServer

func NewTestAPIServer(
	t *testing.T,
	opts ...TestAPIOption,
) *APIServerTestSuite

NewTestAPIServer creates a full API server with all services. It creates a mock database, mock registry, mock validation service, mock message publisher, and mock API server. It returns the mock API server, mock database, and mock API server mocks.

type TestAPIOption added in v1.1.0

type TestAPIOption func(*APIServerTestConfig)

func WithRegistryNodes added in v1.1.0

func WithRegistryNodes(nodes []registry.Node) TestAPIOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL