testqueryclients

package
v0.0.9-3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 22 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,
	supplierOperatorAddress, 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 AddToExistingServices added in v0.0.8

func AddToExistingServices(
	t *testing.T,
	service sharedtypes.Service,
)

AddToExistingServices adds the given service to the services map to mock it "existing" on chain, it will also remove the services from the map when the test is cleaned up.

func AddToExistingSessions

func AddToExistingSessions(
	t *testing.T,
	appAddress string,
	serviceId string,
	blockHeight int64,
	supplierOperatorAddresses []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 NewTestProofQueryClient added in v0.0.3

func NewTestProofQueryClient(t *testing.T) *mockclient.MockProofQueryClient

NewTestProofQueryClient creates a mock of the ProofQueryClient which uses the default proof module params for its GetParams() method implementation.

func NewTestProofQueryClientWithParams added in v0.0.8

func NewTestProofQueryClientWithParams(t *testing.T, params client.ProofParams) *mockclient.MockProofQueryClient

NewTestProofQueryClientWithParams creates a mock of the ProofQueryClient that uses the provided proof module params for its GetParams() method implementation.

func NewTestServiceQueryClient added in v0.0.8

func NewTestServiceQueryClient(
	t *testing.T,
) *mockclient.MockServiceQueryClient

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 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 NewTestSharedQueryClient added in v0.0.3

func NewTestSharedQueryClient(
	t *testing.T,
) *mockclient.MockSharedQueryClient

NewTestSharedQueryClient creates a mock of the SharedQueryClient which uses the default shared module params for its implementation.

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 NewTestTokenomicsQueryClient added in v0.0.8

func NewTestTokenomicsQueryClient(
	t *testing.T,
) *mockclient.MockTokenomicsQueryClient

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

func RemoveAddressFromApplicationMap

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

RemoveAddressFromApplicationMap removes the given address from the addressApplicationMap.

func SetServiceRelayDifficultyTargetHash added in v0.0.8

func SetServiceRelayDifficultyTargetHash(t *testing.T,
	serviceId string,
	relayDifficultyTargetHash []byte,
)

AddServiceRelayDifficultyTargetHash sets the relay difficulty target hash for the given service to mock it "existing" on chain. It will also remove the service relay difficulty target hashes from the map when the test is cleaned up.

Types

This section is empty.

Jump to

Keyboard shortcuts

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