testcommon

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: AGPL-3.0 Imports: 29 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)

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

func TestCallbackServer

func TestCallbackServer(t *testing.T, port string, params map[string]string) *httptest.Server

Types

type APIConnection

type APIConnection struct {
	WS      *websocket.Conn
	HTTP    *http.Client
	Address string
	// 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 NewHTTPapiConnection added in v0.6.0

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

NewHTTPapiConnection 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