cltest

package
v0.0.0-...-5cb58b4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootDir the root directory for cltest
	RootDir = "/tmp/chainlink_test"
	// Username the test username
	Username = "testusername"
	// Email of the API user
	APIEmail = "email@test.net"
	// Password the password
	Password = "password"
	// Session ID for API user
	APISessionID = "session"
	// SessionSecret is the hardcoded secret solely used for test
	SessionSecret = "clsession_test_secret"
)

Variables

This section is empty.

Functions

func AddPrivateKey

func AddPrivateKey(config *TestConfig, src string)

AddPrivateKey adds private key from src to config

func AssertError

func AssertError(t *testing.T, want bool, err error)

func AssertServerResponse

func AssertServerResponse(t *testing.T, resp *http.Response, expectedStatusCode int)

AssertServerResponse is used to match against a client response, will print any errors returned if the request fails.

func AssertValidHash

func AssertValidHash(t *testing.T, length int, hash string)

AssertValidHash checks that a string matches a specific hash format, includes a leading 0x and has a specific length (in bytes)

func BigHexInt

func BigHexInt(val interface{}) hexutil.Big

BigHexInt create hexutil.Big value from given value

func CreateBridgeTypeViaWeb

func CreateBridgeTypeViaWeb(
	t *testing.T,
	app *TestApplication,
	payload string,
) models.BridgeType

CreateBridgeTypeViaWeb creates a bridgetype via web using /v2/bridge_types

func CreateHelloWorldJobViaWeb

func CreateHelloWorldJobViaWeb(t *testing.T, app *TestApplication, url string) models.JobSpec

CreateHelloWorldJobViaWeb creates a HelloWorld JobSpec with the given MockServer Url

func CreateJobRunViaWeb

func CreateJobRunViaWeb(t *testing.T, app *TestApplication, j models.JobSpec, body ...string) models.JobRun

CreateJobRunViaWeb creates JobRun via web using /v2/specs/ID/runs

func CreateJobSpecViaWeb

func CreateJobSpecViaWeb(t *testing.T, app *TestApplication, job models.JobSpec) models.JobSpec

CreateJobSpecViaWeb creates a jobspec via web using /v2/specs

func CreateMockAssignmentViaWeb

func CreateMockAssignmentViaWeb(t *testing.T, app *TestApplication, url string) models.JobSpec

CreateMockAssignmentViaWeb creates a JobSpec with the given MockServer Url

func CreateTxAndAttempt

func CreateTxAndAttempt(
	store *store.Store,
	from common.Address,
	sentAt uint64,
) *models.Tx

CreateTxAndAttempt create tx attempt with given store, from address, and sentat

func DecodeSessionCookie

func DecodeSessionCookie(value string) (string, error)

func FindJob

func FindJob(s *store.Store, id string) models.JobSpec

FindJob returns JobSpec for given JobID

func FindJobRun

func FindJobRun(s *store.Store, id string) models.JobRun

FindJobRun returns JobRun for given JobRunID

func FindServiceAgreement

func FindServiceAgreement(s *store.Store, id string) models.ServiceAgreement

func FixtureCreateJobViaWeb

func FixtureCreateJobViaWeb(t *testing.T, app *TestApplication, path string) models.JobSpec

FixtureCreateJobViaWeb creates a job from a fixture using /v2/specs

func FixtureCreateJobWithAssignmentViaWeb

func FixtureCreateJobWithAssignmentViaWeb(t *testing.T, app *TestApplication, path string) models.JobSpec

FixtureCreateJobWithAssignmentViaWeb creates a job from a fixture using /v1/assignments

func FixtureCreateServiceAgreementViaWeb

func FixtureCreateServiceAgreementViaWeb(
	t *testing.T,
	app *TestApplication,
	path string,
) models.ServiceAgreement

FixtureCreateServiceAgreementViaWeb creates a service agreement from a fixture using /v2/service_agreements

func GetAccountAddress

func GetAccountAddress(store *store.Store) common.Address

GetAccountAddress returns Address of the account in the keystore of the passed in store

func IndexableBlockNumber

func IndexableBlockNumber(val interface{}) *models.IndexableBlockNumber

IndexableBlockNumber given the value convert it into an IndexableBlockNumber

func Int

func Int(val interface{}) *models.Int

func JSONFromFixture

func JSONFromFixture(path string) models.JSON

JSONFromFixture create models.JSON from file path

func JSONFromString

func JSONFromString(body string, args ...interface{}) models.JSON

JSONFromString create JSON from given body and arguments

func JSONResultFromFixture

func JSONResultFromFixture(path string) models.JSON

JSONResultFromFixture create model.JSON with params.result found in the given file path

func JobRunStays

func JobRunStays(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
	status models.RunStatus,
) models.JobRun

JobRunStays tests if a JobRun will consistently stay at the specified status

func JobRunStaysPendingConfirmations

func JobRunStaysPendingConfirmations(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
) models.JobRun

JobRunStaysPendingConfirmations tests if a JobRun will stay at the PendingConfirmations Status

func LoadJSON

func LoadJSON(file string) []byte

LoadJSON loads json from file and returns a byte slice

func LogFromFixture

func LogFromFixture(path string) ethtypes.Log

LogFromFixture create ethtypes.log from file path

func MarkJobRunPendingBridge

func MarkJobRunPendingBridge(jr models.JobRun, i int) models.JobRun

MarkJobRunPendingBridge marks the jobrun as Pending Bridge Status

func MustGenerateSessionCookie

func MustGenerateSessionCookie(value string) *http.Cookie

func MustParseDuration

func MustParseDuration(durationStr string) time.Duration

func MustParseWebURL

func MustParseWebURL(str string) models.WebURL

MustParseWebURL must parse the given url and return it

func MustUser

func MustUser(email, pwd string) models.User

func NewAddress

func NewAddress() common.Address

NewAddress return a random new address

func NewBigHexInt

func NewBigHexInt(val interface{}) *hexutil.Big

NewBigHexInt creates new BigHexInt from value

func NewBlockHeader

func NewBlockHeader(number int) *models.BlockHeader

NewBlockHeader return a new BlockHeader with given number

func NewBridgeType

func NewBridgeType(info ...string) models.BridgeType

NewBridgeType create new bridge type given info slice

func NewBridgeTypeWithConfirmations

func NewBridgeTypeWithConfirmations(confirmations uint64, info ...string) models.BridgeType

NewBridgeTypeWithConfirmations creates a new bridge type with given default confs and info slice

func NewHTTPMockServer

func NewHTTPMockServer(
	t *testing.T,
	status int,
	wantMethod string,
	response string,
	callback ...func(http.Header, string),
) (*httptest.Server, func())

NewHTTPMockServer create http test server with passed in parameters

func NewHash

func NewHash() common.Hash

NewHash return random Keccak256

func NewJob

func NewJob() models.JobSpec

NewJob return new NoOp JobSpec

func NewJobRunner

func NewJobRunner(s *store.Store) (services.JobRunner, func())

func NewJobSubscriber

func NewJobSubscriber() (*store.Store, services.JobSubscriber, func())

NewJobSubscriber creates a new JobSubscriber

func NewJobWithLogInitiator

func NewJobWithLogInitiator() (models.JobSpec, models.Initiator)

NewJobWithLogInitiator create new Job with ethlog inititaor

func NewJobWithRunAtInitiator

func NewJobWithRunAtInitiator(t time.Time) (models.JobSpec, models.Initiator)

NewJobWithRunAtInitiator create new Job with RunAt inititaor

func NewJobWithSchedule

func NewJobWithSchedule(sched string) (models.JobSpec, models.Initiator)

NewJobWithSchedule create new job with the given schedule

func NewJobWithWebInitiator

func NewJobWithWebInitiator() (models.JobSpec, models.Initiator)

NewJobWithWebInitiator create new Job with web inititaor

func NewMockAuthenticatedHTTPClient

func NewMockAuthenticatedHTTPClient(cfg store.Config) cmd.HTTPClient

func NewRunLog

func NewRunLog(jobID string, addr common.Address, blk int, json string) ethtypes.Log

NewRunLog create ethtypes.Log for given jobid, address, block, and json

func NewSession

func NewSession(optionalSessionID ...string) models.Session

func NewStore

func NewStore() (*store.Store, func())

NewStore creates a new store

func NewStoreWithConfig

func NewStoreWithConfig(config *TestConfig) (*store.Store, func())

NewStoreWithConfig creates a new store with given config

func NewTask

func NewTask(taskType string, json ...string) models.TaskSpec

NewTask given the tasktype and json params return a TaskSpec

func NewTx

func NewTx(from common.Address, sentAt uint64) *models.Tx

NewTx create a tx given from address and sentat

func NewWSServer

func NewWSServer(msg string) (*httptest.Server, func())

NewWSServer returns a new wsserver

func NormalizedJSON

func NormalizedJSON(input []byte) string

func NullString

func NullString(val interface{}) null.String

NullString creates null.String from given value

func NullTime

func NullTime(val interface{}) null.Time

NullTime creates a null.Time from given value

func NullableTime

func NullableTime(t time.Time) null.Time

NullableTime will return a valid nullable time given time.Time

func ObserveLogs

func ObserveLogs() *observer.ObservedLogs

ObserveLogs returns the observed logs

func ParseISO8601

func ParseISO8601(s string) time.Time

ParseISO8601 given the time string it Must parse the time and return it

func ParseJSON

func ParseJSON(body io.Reader) models.JSON

func ParseJSONAPIErrors

func ParseJSONAPIErrors(body io.Reader) *models.JSONAPIErrors

func ParseJSONAPIResponse

func ParseJSONAPIResponse(resp *http.Response, resource interface{}) error

ParseJSONAPIResponse parses the response and returns the JSONAPI resource.

func ParseJSONAPIResponseMeta

func ParseJSONAPIResponseMeta(input []byte) (map[string]*json.RawMessage, error)

ParseJSONAPIResponseMeta parses the bytes of the root document and returns a map of *json.RawMessage's within the 'meta' key.

func ParseJSONAPIResponseMetaCount

func ParseJSONAPIResponseMetaCount(input []byte) (int, error)

ParseJSONAPIResponseMetaCount parses the bytes of the root document and returns the value of the 'count' key from the 'meta' section.

func ParseNullableTime

func ParseNullableTime(s string) null.Time

ParseNullableTime given a time string parse it into a null.Time

func ParseResponseBody

func ParseResponseBody(resp *http.Response) []byte

ParseResponseBody will parse the given response into a byte slice

func ReadLogs

func ReadLogs(app *TestApplication) (string, error)

ReadLogs returns the contents of the applications log file as a string

func ResetBucket

func ResetBucket(store *store.Store, bucket interface{})

func RunResultWithData

func RunResultWithData(val string) models.RunResult

RunResultWithData creates a run result with a given data JSON object

func RunResultWithError

func RunResultWithError(err error) models.RunResult

RunResultWithError creates a runresult with given error

func RunResultWithValue

func RunResultWithValue(val string) models.RunResult

RunResultWithValue creates a runresult with given value

func ServiceAgreementFromString

func ServiceAgreementFromString(str string) (models.ServiceAgreement, error)

func StringToHash

func StringToHash(s string) common.Hash

StringToHash give Keccak256 hash of string

func StringToVersionedLogData

func StringToVersionedLogData(str string) hexutil.Bytes

StringToVersionedLogData encodes a string to the log data field.

func UnauthenticatedPatch

func UnauthenticatedPatch(url string, body io.Reader, headers map[string]string) (*http.Response, func())

func UnwrapAdapter

func UnwrapAdapter(wa adapters.AdapterWithMinConfs) adapters.Adapter

UnwrapAdapter unwraps the adapter from given wrapped adapter

func UpdateJobRunViaWeb

func UpdateJobRunViaWeb(
	t *testing.T,
	app *TestApplication,
	jr models.JobRun,
	body string,
) models.JobRun

UpdateJobRunViaWeb updates jobrun via web using /v2/runs/ID

func WaitForJobRunStatus

func WaitForJobRunStatus(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
	status models.RunStatus,
) models.JobRun

WaitForJobRunStatus waits for a JobRun to reach given status

func WaitForJobRunToComplete

func WaitForJobRunToComplete(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToComplete waits for a JobRun to reach Completed Status

func WaitForJobRunToPendBridge

func WaitForJobRunToPendBridge(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToPendBridge waits for a JobRun to reach PendingBridge Status

func WaitForJobRunToPendConfirmations

func WaitForJobRunToPendConfirmations(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToPendConfirmations waits for a JobRun to reach PendingConfirmations Status

func WaitForJobs

func WaitForJobs(t *testing.T, store *store.Store, want int) []models.JobSpec

WaitForJobs waits for the wanted number of jobs.

func WaitForRuns

func WaitForRuns(t *testing.T, j models.JobSpec, store *store.Store, want int) []models.JobRun

WaitForRuns waits for the wanted number of runs then returns a slice of the JobRuns

func WebURL

func WebURL(unparsed string) models.WebURL

WebURL parses a url into a models.WebURL

Types

type CallbackAuthenticator

type CallbackAuthenticator struct {
	Callback func(*store.Store, string) error
}

CallbackAuthenticator contains a call back authenticator method

func (CallbackAuthenticator) Authenticate

func (a CallbackAuthenticator) Authenticate(store *store.Store, pwd string) error

Authenticate authenticates store and pwd with the callback authenticator

type CommonJSON

type CommonJSON struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Digest string `json:"digest"`
}

CommonJSON has an ID, and Name

func ParseCommonJSON

func ParseCommonJSON(body io.Reader) CommonJSON

ParseCommonJSON will unmarshall given body into CommonJSON

type EasyJSON

type EasyJSON struct {
	models.JSON
}

func EasyJSONFromFixture

func EasyJSONFromFixture(path string) EasyJSON

func EasyJSONFromString

func EasyJSONFromString(body string, args ...interface{}) EasyJSON

func (EasyJSON) Add

func (ejs EasyJSON) Add(key string, val interface{}) EasyJSON

func (EasyJSON) Delete

func (ejs EasyJSON) Delete(key string) EasyJSON

type EmptyAppFactory

type EmptyAppFactory struct{}

EmptyAppFactory an empty application factory

func (EmptyAppFactory) NewApplication

func (f EmptyAppFactory) NewApplication(config store.Config) services.Application

NewApplication creates a new empty application with specified config

type EmptyApplication

type EmptyApplication struct{}

EmptyApplication an empty application

func (*EmptyApplication) GetStore

func (a *EmptyApplication) GetStore() *store.Store

GetStore retrieves the store of the empty application

func (*EmptyApplication) Start

func (a *EmptyApplication) Start() error

Start starts the empty application

func (*EmptyApplication) Stop

func (a *EmptyApplication) Stop() error

Stop stopts the empty application

type EmptyRunner

type EmptyRunner struct{}

EmptyRunner is an EmptyRunner

func (EmptyRunner) Run

Run runs the empty runner

type ErrorsJSON

type ErrorsJSON struct {
	Errors []string `json:"errors"`
}

ErrorsJSON has an errors attribute

func ParseErrorsJSON

func ParseErrorsJSON(body io.Reader) ErrorsJSON

ParseErrorsJSON will unmarshall given body into ErrorsJSON

type EthMock

type EthMock struct {
	Responses     []MockResponse
	Subscriptions []MockSubscription
	// contains filtered or unexported fields
}

EthMock is a mock ethereum client

func MockEthOnStore

func MockEthOnStore(s *store.Store) *EthMock

MockEthOnStore given store return new EthMock Client

func (*EthMock) AllCalled

func (mock *EthMock) AllCalled() bool

AllCalled return true if all mocks have been mocked

func (*EthMock) Call

func (mock *EthMock) Call(result interface{}, method string, args ...interface{}) error

Call will call given method and set the result

func (*EthMock) Context

func (mock *EthMock) Context(context string, callback func(*EthMock))

Context adds helpful context to EthMock values set in the callback function.

func (*EthMock) Dial

func (mock *EthMock) Dial(url string) (store.CallerSubscriber, error)

Dial mock dial

func (*EthMock) EthSubscribe

func (mock *EthMock) EthSubscribe(
	ctx context.Context,
	channel interface{},
	args ...interface{},
) (models.EthSubscription, error)

EthSubscribe registers a subscription to the channel

func (*EthMock) EventuallyAllCalled

func (mock *EthMock) EventuallyAllCalled(t *testing.T)

EventuallyAllCalled eventually will return after all the mock subscriptions and responses are called

func (*EthMock) Register

func (mock *EthMock) Register(
	method string,
	response interface{},
	callback ...func(interface{}, ...interface{}) error,
)

Register register mock responses and append to Ethmock

func (*EthMock) RegisterError

func (mock *EthMock) RegisterError(method, errMsg string)

RegisterError register mock errors to EthMock

func (*EthMock) RegisterNewHead

func (mock *EthMock) RegisterNewHead(blockNumber int64) chan models.BlockHeader

RegisterNewHead register new head at given blocknumber

func (*EthMock) RegisterNewHeads

func (mock *EthMock) RegisterNewHeads() chan models.BlockHeader

RegisterNewHeads registers a newheads subscription

func (*EthMock) RegisterSubscription

func (mock *EthMock) RegisterSubscription(name string, channels ...interface{}) MockSubscription

RegisterSubscription register a mock subscription to the given name and channels

type HTTPClientCleaner

type HTTPClientCleaner struct {
	HTTPClient cmd.HTTPClient
}

func (*HTTPClientCleaner) Delete

func (r *HTTPClientCleaner) Delete(path string) (*http.Response, func())

func (*HTTPClientCleaner) Get

func (r *HTTPClientCleaner) Get(path string, headers ...map[string]string) (*http.Response, func())

func (*HTTPClientCleaner) Patch

func (r *HTTPClientCleaner) Patch(path string, body io.Reader, headers ...map[string]string) (*http.Response, func())

func (*HTTPClientCleaner) Post

func (r *HTTPClientCleaner) Post(path string, body io.Reader) (*http.Response, func())

type InstanceAppFactory

type InstanceAppFactory struct {
	App services.Application
}

InstanceAppFactory is an InstanceAppFactory

func (InstanceAppFactory) NewApplication

func (f InstanceAppFactory) NewApplication(config store.Config) services.Application

NewApplication creates a new application with specified config

type InstantClock

type InstantClock struct{}

InstantClock an InstantClock

func (InstantClock) After

func (InstantClock) After(_ time.Duration) <-chan time.Time

After return channel of time

func (InstantClock) Now

func (InstantClock) Now() time.Time

Now current local time

type MockAPIInitializer

type MockAPIInitializer struct {
	Count int
}

func (*MockAPIInitializer) Initialize

func (m *MockAPIInitializer) Initialize(store *store.Store) (models.User, error)

type MockCookieAuthenticator

type MockCookieAuthenticator struct {
	Error error
}

func (MockCookieAuthenticator) Authenticate

func (MockCookieAuthenticator) Cookie

func (m MockCookieAuthenticator) Cookie() (*http.Cookie, error)

type MockCountingPrompter

type MockCountingPrompter struct {
	EnteredStrings []string
	Count          int
}

MockCountingPrompter is a mock counting prompt

func (*MockCountingPrompter) IsTerminal

func (p *MockCountingPrompter) IsTerminal() bool

IsTerminal always returns true in tests

func (*MockCountingPrompter) PasswordPrompt

func (p *MockCountingPrompter) PasswordPrompt(string) string

PasswordPrompt returns an entered string

func (*MockCountingPrompter) Prompt

func (p *MockCountingPrompter) Prompt(string) string

Prompt returns an entered string

type MockCron

type MockCron struct {
	Entries []MockCronEntry
}

MockCron represents a mock cron

func NewMockCron

func NewMockCron() *MockCron

NewMockCron returns a new mock cron

func (*MockCron) AddFunc

func (mc *MockCron) AddFunc(schd string, fn func()) error

AddFunc appends a schedule to mockcron entries

func (*MockCron) RunEntries

func (mc *MockCron) RunEntries()

RunEntries run every function for each mockcron entry

func (*MockCron) Start

func (*MockCron) Start()

Start starts the mockcron

func (*MockCron) Stop

func (*MockCron) Stop()

Stop stops the mockcron

type MockCronEntry

type MockCronEntry struct {
	Schedule string
	Function func()
}

MockCronEntry a cron schedule and function

type MockHeadTrackable

type MockHeadTrackable struct {
	// contains filtered or unexported fields
}

MockHeadTrackable allows you to mock HeadTrackable

func (*MockHeadTrackable) Connect

Connect increases the connected count by one

func (*MockHeadTrackable) ConnectedCount

func (m *MockHeadTrackable) ConnectedCount() int32

ConnectedCount returns the count of connections made, safely.

func (*MockHeadTrackable) Disconnect

func (m *MockHeadTrackable) Disconnect()

Disconnect increases the disconnected count by one

func (*MockHeadTrackable) DisconnectedCount

func (m *MockHeadTrackable) DisconnectedCount() int32

DisconnectedCount returns the count of disconnections made, safely.

func (*MockHeadTrackable) OnNewHead

func (m *MockHeadTrackable) OnNewHead(*models.BlockHeader)

OnNewHead increases the OnNewHeadCount count by one

func (*MockHeadTrackable) OnNewHeadCount

func (m *MockHeadTrackable) OnNewHeadCount() int32

OnNewHeadCount returns the count of new heads, safely.

type MockResponse

type MockResponse struct {
	// contains filtered or unexported fields
}

MockResponse a mock response

type MockRunChannel

type MockRunChannel struct {
	Runs         []models.RunResult
	BlockNumbers []*models.IndexableBlockNumber
	// contains filtered or unexported fields
}

func NewMockRunChannel

func NewMockRunChannel() *MockRunChannel

func (*MockRunChannel) Close

func (m *MockRunChannel) Close()

func (*MockRunChannel) Receive

func (m *MockRunChannel) Receive() <-chan store.RunRequest

func (*MockRunChannel) Send

type MockSessionRequestBuilder

type MockSessionRequestBuilder struct {
	Count int
	Error error
}

func (*MockSessionRequestBuilder) Build

type MockSigner

type MockSigner struct{}

func (MockSigner) Sign

func (s MockSigner) Sign(input []byte) (models.Signature, error)

type MockSubscription

type MockSubscription struct {
	Errors chan error
	// contains filtered or unexported fields
}

MockSubscription a mock subscription

func EmptyMockSubscription

func EmptyMockSubscription() MockSubscription

EmptyMockSubscription return empty MockSubscription

func (MockSubscription) Err

func (mes MockSubscription) Err() <-chan error

Err returns error channel from mes

func (MockSubscription) Unsubscribe

func (mes MockSubscription) Unsubscribe()

Unsubscribe closes the subscription

type NeverClock

type NeverClock struct{}

NeverClock a never clock

func (NeverClock) After

func (NeverClock) After(_ time.Duration) <-chan time.Time

After return channel of time

func (NeverClock) Now

func (NeverClock) Now() time.Time

Now returns current local time

type NeverSleeper

type NeverSleeper struct{}

NeverSleeper is a struct that never sleeps

func (NeverSleeper) Duration

func (ns NeverSleeper) Duration() time.Duration

Duration returns a duration

func (NeverSleeper) Reset

func (ns NeverSleeper) Reset()

Reset resets the never sleeper

func (NeverSleeper) Sleep

func (ns NeverSleeper) Sleep()

Sleep puts the never sleeper to sleep

type RendererMock

type RendererMock struct {
	Renders []interface{}
}

RendererMock a mock renderer

func (*RendererMock) Render

func (rm *RendererMock) Render(v interface{}) error

Render appends values to renderer mock

type SettableClock

type SettableClock struct {
	// contains filtered or unexported fields
}

SettableClock a settable clock

func UseSettableClock

func UseSettableClock(s *store.Store) *SettableClock

UseSettableClock creates a SettableClock on the store

func (*SettableClock) After

func (*SettableClock) After(_ time.Duration) <-chan time.Time

After return channel of time

func (*SettableClock) Now

func (clock *SettableClock) Now() time.Time

Now get the current time

func (*SettableClock) SetTime

func (clock *SettableClock) SetTime(t time.Time)

SetTime set the current time

type TestApplication

type TestApplication struct {
	*services.ChainlinkApplication
	Config store.Config
	Server *httptest.Server
	// contains filtered or unexported fields
}

TestApplication holds the test application and test servers

func NewApplication

func NewApplication() (*TestApplication, func())

NewApplication creates a New TestApplication along with a NewConfig

func NewApplicationWithConfig

func NewApplicationWithConfig(tc *TestConfig) (*TestApplication, func())

NewApplicationWithConfig creates a New TestApplication with specified test config

func NewApplicationWithConfigAndKeyStore

func NewApplicationWithConfigAndKeyStore(tc *TestConfig) (*TestApplication, func())

NewApplicationWithConfigAndKeyStore creates a new TestApplication with the given testconfig it will also provide an unlocked account on the keystore

func NewApplicationWithConfigAndUnlockedAccount

func NewApplicationWithConfigAndUnlockedAccount(tc *TestConfig) (*TestApplication, func())

NewApplicationWithConfigAndUnlockedAccount creates a new TestApplication with an unlocked account, expected to be used with NewConfigWithPrivateKey

func NewApplicationWithKeyStore

func NewApplicationWithKeyStore() (*TestApplication, func())

NewApplicationWithKeyStore creates a new TestApplication along with a new config

func (*TestApplication) InstantClock

func (ta *TestApplication) InstantClock() InstantClock

InstantClock create InstantClock

func (*TestApplication) MockEthClient

func (ta *TestApplication) MockEthClient() *EthMock

MockEthClient create new EthMock Client

func (*TestApplication) MustSeedUserSession

func (ta *TestApplication) MustSeedUserSession() models.User

func (*TestApplication) NewAuthenticatingClient

func (ta *TestApplication) NewAuthenticatingClient(prompter cmd.Prompter) *cmd.Client

func (*TestApplication) NewClientAndRenderer

func (ta *TestApplication) NewClientAndRenderer() (*cmd.Client, *RendererMock)

NewClientAndRenderer creates a new cmd.Client for the test application

func (*TestApplication) NewHTTPClient

func (ta *TestApplication) NewHTTPClient() HTTPClientCleaner

func (*TestApplication) Stop

func (ta *TestApplication) Stop() error

Stop will stop the test application and perform cleanup

type TestConfig

type TestConfig struct {
	store.Config
	// contains filtered or unexported fields
}

TestConfig struct with test store and wsServer

func NewConfig

func NewConfig() (*TestConfig, func())

NewConfig returns a new TestConfig

func NewConfigWithPrivateKey

func NewConfigWithPrivateKey() (*TestConfig, func())

func NewConfigWithWSServer

func NewConfigWithWSServer(wsserver *httptest.Server) *TestConfig

NewConfigWithWSServer return new config with specified wsserver

func (*TestConfig) SetEthereumServer

func (tc *TestConfig) SetEthereumServer(wss *httptest.Server)

SetEthereumServer sets the ethereum server for testconfig with given wsserver

Jump to

Keyboard shortcuts

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