cosmos-sdk: Index | Files | Directories

package testutil

import ""


Package Files

ioutil.go known_values.go rest.go


const (
    // Tests expect a ledger device initialized to the following mnemonic
    TestMnemonic = "equip will roof matter pink blind book anxiety banner elbow sun young"

func ApplyMockIO Uses

func ApplyMockIO(c *cobra.Command) (BufferReader, BufferWriter)

ApplyMockIO replaces stdin/out/err with buffers that can be used during testing. Returns an input BufferReader and an output BufferWriter.

func GetRequestWithHeaders Uses

func GetRequestWithHeaders(url string, headers map[string]string) ([]byte, error)

GetRequestWithHeaders defines a wrapper around an HTTP GET request with a provided URL and custom headers An error is returned if the request or reading the body fails.

func WriteToNewTempFile Uses

func WriteToNewTempFile(t testing.TB, s string) (*os.File, func())

Write the given string to a new temporary file. Returns an open file and a clean up function that the caller must call to remove the file when it is no longer needed.

type BufferReader Uses

type BufferReader interface {

BufferReader is implemented by types that read from a string buffer.

func ApplyMockIODiscardOutErr Uses

func ApplyMockIODiscardOutErr(c *cobra.Command) BufferReader

ApplyMockIODiscardOutputs replaces a cobra.Command output and error streams with a dummy io.Writer. Replaces and returns the io.Reader associated to the cobra.Command input stream.

type BufferWriter Uses

type BufferWriter interface {
    Bytes() []byte
    String() string

BufferWriter is implemented by types that write to a buffer.


networkPackage network implements and exposes a fully operational in-process Tendermint test network that consists of at least one or potentially many validators.

Package testutil imports 9 packages (graph) and is imported by 9 packages. Updated 2020-09-23. Refresh now. Tools for package owners.