testutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ChainSourceHash = "testhash"
	ChainSourceURL  = "http://example.com/test"
	ChainConfigYML  = "config.yml"
	ChainName       = "test"
	ChainID         = "test-1"
	TCPAddress      = "1.2.3.4"
	NodeID          = "9b1f4adbfb0c0b513040d914bfb717303c0eaa71"
	PeerAddress     = "9b1f4adbfb0c0b513040d914bfb717303c0eaa71@1.2.3.4"
)
View Source
const (
	LaunchID  = uint64(1)
	ProjectID = uint64(1)
	MainnetID = uint64(1)
)
View Source
const (
	TestAccountName = "test"
)

Variables

This section is empty.

Functions

func NewResponse

func NewResponse(data protoiface.MessageV1) cosmosclient.Response

NewResponse creates cosmosclient.Response object from proto struct for using as a return result for a cosmosclient mock.

func NewTestAccount

func NewTestAccount(t *testing.T, name string) cosmosaccount.Account

NewTestAccount creates an account for test purposes using in-memory keyring backend.

Types

type AccountInfo

type AccountInfo interface {
	keyring.Record
}

type AppState

type AppState struct {
	Auth    Auth    `json:"auth"`
	Staking Staking `json:"staking"`
}

type Auth

type Auth struct {
	Accounts []GenesisAccount `json:"accounts"`
}

type BankClient

type BankClient interface {
	banktypes.QueryClient
}

type Body

type Body struct {
	Messages []Message `json:"messages"`
	Memo     string    `json:"memo"`
}

type Genesis

type Genesis struct {
	ChainID  string   `json:"chain_id"`
	AppState AppState `json:"app_state"`
}

func NewGenesis

func NewGenesis(chainID string) *Genesis

NewGenesis creates easily modifiable genesis object for testing purposes.

func (*Genesis) AddAccount

func (g *Genesis) AddAccount(address string) *Genesis

AddAccount adds account to the genesis.

func (*Genesis) SaveTo

func (g *Genesis) SaveTo(t *testing.T, dir string) string

SaveTo saves genesis json representation to the specified directory and returns full path.

type GenesisAccount

type GenesisAccount struct {
	Address string `json:"address"`
}

type Gentx

type Gentx struct {
	Body Body `json:"body"`
}

func NewGentx

func NewGentx(address, denom, amount, pubkey, memo string) *Gentx

NewGentx creates easily modifiable gentx object for testing purposes.

func (*Gentx) JSON

func (g *Gentx) JSON(t *testing.T) []byte

JSON returns json representation of the gentx.

func (*Gentx) SaveTo

func (g *Gentx) SaveTo(t *testing.T, dir string) string

SaveTo saves gentx json representation to the specified directory and returns full path.

type LaunchClient

type LaunchClient interface {
	launchtypes.QueryClient
}

type Message

type Message struct {
	DelegatorAddress string        `json:"delegator_address"`
	ValidatorAddress string        `json:"validator_address"`
	PubKey           MessagePubKey `json:"pubkey"`
	Value            MessageValue  `json:"value"`
}

type MessagePubKey

type MessagePubKey struct {
	Key string `json:"key"`
}

type MessageValue

type MessageValue struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type ProfileClient

type ProfileClient interface {
	profiletypes.QueryClient
}

type ProjectClient

type ProjectClient interface {
	projecttypes.QueryClient
}

type RewardClient

type RewardClient interface {
	rewardtypes.QueryClient
}

type Staking

type Staking struct {
	Params StakingParams `json:"params"`
}

type StakingClient

type StakingClient interface {
	stakingtypes.QueryClient
}

type StakingParams

type StakingParams struct {
	BondDenom string `json:"bond_denom"`
}

type Suite

type Suite struct {
	ChainMock                *mocks.Chain
	CosmosClientMock         *mocks.CosmosClient
	LaunchQueryMock          *mocks.LaunchClient
	ProjectQueryMock         *mocks.ProjectClient
	ProfileQueryMock         *mocks.ProfileClient
	RewardClient             *mocks.RewardClient
	StakingClient            *mocks.StakingClient
	BankClient               *mocks.BankClient
	MonitoringConsumerClient *mocks.MonitoringcClient
}

Suite is a mocks container, used to write less code for tests setup.

func NewSuite

func NewSuite() Suite

NewSuite creates new suite with mocks.

func (*Suite) AssertAllMocks

func (s *Suite) AssertAllMocks(t *testing.T)

AssertAllMocks asserts all suite mocks expectations.

Jump to

Keyboard shortcuts

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