testutil

package
v0.0.0-...-7149754 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainSourceHash = "testhash"
	ChainSourceURL  = "http://example.com/test"
	ChainName       = "test"
	ChainID         = "test-1"
	TCPAddress      = "1.2.3.4"
	NodeID          = "9b1f4adbfb0c0b513040d914bfb717303c0eaa71"
	PeerAddress     = "9b1f4adbfb0c0b513040d914bfb717303c0eaa71@1.2.3.4"
)
View Source
const (
	LaunchID   = uint64(1)
	CampaignID = 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 inmemory keyring backend

Types

type AccountInfo

type AccountInfo interface {
	keyring.Info
}

type AppState

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

type Auth

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

type Body

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

type CampaignClient

type CampaignClient interface {
	campaigntypes.QueryClient
}

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

// NewGenesis 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 RewardClient

type RewardClient interface {
	rewardtypes.QueryClient
}

type Staking

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

type StakingParams

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

type Suite

type Suite struct {
	ChainMock         *mocks.Chain
	CosmosClientMock  *mocks.CosmosClient
	LaunchQueryMock   *mocks.LaunchClient
	CampaignQueryMock *mocks.CampaignClient
	ProfileQueryMock  *mocks.ProfileClient
	RewardClient      *mocks.RewardClient
}

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