test

package
v0.0.0-...-08046e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PostLatency is the expected latency between a test running an the created
	// stamp of an object we created within a test.
	PostLatency time.Duration = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mint

type Mint struct {
	Server  *httptest.Server
	Mux     *goji.Mux
	Env     *env.Env
	DB      *sqlx.DB
	Ctx     context.Context
	TmpFile string
}

Mint represents a test mint.

func CreateMint

func CreateMint(
	t *testing.T,
) *Mint

CreateMint creates a new test mint with an in-memory DB and returns test.Mint object.

func (*Mint) Close

func (m *Mint) Close()

Close closes the mint after usage.

func (*Mint) CreateUser

func (m *Mint) CreateUser(
	t *testing.T,
) *MintUser

CreateUser creates a user and generates an associated MintUser

func (*Mint) Get

func (m *Mint) Get(
	t *testing.T,
	user *MintUser,
	path string,
) (int, svc.Resp)

Get gets a specified endpoint on the mint.

func (*Mint) Post

func (m *Mint) Post(
	t *testing.T,
	user *MintUser,
	path string,
	params url.Values,
) (int, svc.Resp)

Post posts to a specified endpoint on the mint.

type MintUser

type MintUser struct {
	Mint     *Mint
	Username string
	Password string
	Address  string
}

MintUser reprensents a user of a mint, generally generated by CreateUser.

func (*MintUser) CreateAsset

func (u *MintUser) CreateAsset(
	t *testing.T,
	code string,
	scale int8,
) mint.AssetResource

CreateAsset creates a new assset for this test user

func (*MintUser) CreateOffer

func (u *MintUser) CreateOffer(
	t *testing.T,
	pair string,
	price string,
	amount *big.Int,
) mint.OfferResource

CreateOffer creates a new ofer for this test user

func (*MintUser) Get

func (u *MintUser) Get(
	t *testing.T,
	path string,
) (int, svc.Resp)

Get gets a specified endpoint on the mint.

func (*MintUser) Post

func (u *MintUser) Post(
	t *testing.T,
	path string,
	params url.Values,
) (int, svc.Resp)

Post posts to a specified endpoint on the mint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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