testqueryclients

package
v0.0.0-...-b8c38bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package testqueryclients provides helper functions for contstructing mock AccountQueryClient objects parameterized call arguments, return value(s), and/or expectations thereof. Intended for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAddressToApplicationMap

func AddAddressToApplicationMap(
	t *testing.T,
	address string, pubkey cryptotypes.PubKey,
	delegateeAccounts map[string]cryptotypes.PubKey,
)

AddAddressToApplicationMap adds the given address to the addressApplicationMap with the given delegated gateways addresses. It also adds it to the addressAccountMap so that the account will be deemed to exist on chain.

func AddSuppliersWithServiceEndpoints

func AddSuppliersWithServiceEndpoints(
	t *testing.T,
	address, service string,
	endpoints []*sharedtypes.SupplierEndpoint,
)

AddSupplierWithServiceEndpoints adds the given address and ServiceEndpoints to the suppliersProvidedServicesMap to mock it "existing" on chain, it will also remove the address from the map when the test is cleaned up.

func AddToExistingSessions

func AddToExistingSessions(
	t *testing.T,
	appAddress string,
	serviceId string,
	blockHeight int64,
	suppliersAddress []string,
)

AddToExistingSessions adds the given session to the sessionsMap to mock it "existing" on chain, it will also remove the sessions from the map when the test is cleaned up.

func NewTestAccountQueryClient

func NewTestAccountQueryClient(
	t *testing.T,
) *mockclient.MockAccountQueryClient

NewTestAccountQueryClient creates a mock of the AccountQueryClient which allows the caller to call GetApplication any times and will return an application with the given address.

func NewTestApplicationQueryClient

func NewTestApplicationQueryClient(
	t *testing.T,
) *mockclient.MockApplicationQueryClient

NewTestApplicationQueryClient creates a mock of the ApplicationQueryClient which allows the caller to call GetApplication any times and will return an application with the given address.

func NewTestSessionQueryClient

func NewTestSessionQueryClient(
	t *testing.T,
) *mockclient.MockSessionQueryClient

NewTestSessionQueryClient creates a mock of the SessionQueryClient which allows the caller to call GetSession any times and will return the session matching the app address, serviceID and the blockHeight passed.

func NewTestSupplierQueryClient

func NewTestSupplierQueryClient(
	t *testing.T,
) *mockclient.MockSupplierQueryClient

NewTestSupplierQueryClient creates a mock of the SupplierQueryClient which allows the caller to call GetSupplier any times and will return an application with the given address.

func RemoveAddressFromApplicationMap

func RemoveAddressFromApplicationMap(t *testing.T, address string)

RemoveAddressFromApplicationMap removes the given address from the addressApplicationMap.

Types

This section is empty.

Jump to

Keyboard shortcuts

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