testcommon

package
v0.0.0-...-804652f Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEntities

func CreateEntities(size int) ([]*ethereum.SignKeys, []*types.Entity, error)

CreateEntities a given number of random entities

func CreateEthRandomKeysBatch

func CreateEthRandomKeysBatch(n int) []*ethereum.SignKeys

CreateEthRandomKeysBatch creates a set of eth random signing keys

func CreateMembers

func CreateMembers(entityID []byte, size int) ([]*ethereum.SignKeys, []*types.Member, error)

CreateMembers a given number of members with its entityID set to entityID

func RandBool

func RandBool() bool

RandBool creates a random bool

func RandDate

func RandDate() time.Time

RandDate creates a random date

Types

type APIConnection

type APIConnection struct {
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

APIConnection holds an API websocket connection

func NewAPIConnection

func NewAPIConnection(addr string, tb testing.TB) (*APIConnection, error)

NewAPIConnection starts a connection with the given endpoint address. The connection is closed automatically when the test or benchmark finishes.

func (*APIConnection) Request

Request makes a request to the previously connected endpoint

type TestAPI

type TestAPI struct {
	DB     database.Database
	EP     *endpoint.EndPoint
	Port   int
	Signer *ethereum.SignKeys
}

func (*TestAPI) Start

func (t *TestAPI) Start(dbc *config.DB, route string) error

Start creates a new database connection and API endpoint for testing. If dbc is nill the testdb will be used. If route is nill, then the websockets API won't be initialized

Jump to

Keyboard shortcuts

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