bootstrap

package
v0.0.0-...-6c4cad4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAccountCommandContext

func RegisterAccountCommandContext(s *godog.Suite, db *sqlx.DB)

func RegisterBankingCommandContext

func RegisterBankingCommandContext(s *godog.Suite, db *sqlx.DB)

func RegisterCommandContext

func RegisterCommandContext(s *godog.Suite)

func RegisterCsvFileContext

func RegisterCsvFileContext(s *godog.Suite, importPath string)

func RegisterCurrencyConverterContext

func RegisterCurrencyConverterContext(s *godog.Suite, currencyConverterAPI *WireMock)

func RegisterStockCommandContext

func RegisterStockCommandContext(s *godog.Suite, db *sqlx.DB, yahooFinanceWeb, query1FinanceWeb *WireMock)

Types

type DBContext

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

func RegisterDBContext

func RegisterDBContext(s *godog.Suite, db *sqlx.DB) *DBContext

RegisterDBContext is the place to truncate database and run background givens

type Request

type Request struct {
	Method string `json:"method"`
	URL    string `json:"url"`
	Body   string `json:"body,omitempty"`
}

Request is the configuration to the request of a mock.

func NewWireMockRequest

func NewWireMockRequest() *Request

NewWireMockRequest creates and returns a new request.

func (*Request) SetMethod

func (r *Request) SetMethod(method string)

SetMethod adds a method to the request.

func (*Request) SetURL

func (r *Request) SetURL(url string)

SetURL adds a url to the request.

type Response

type Response struct {
	Status int               `json:"status"`
	Body   string            `json:"body"`
	Header map[string]string `json:"headers"`
}

Response is the configuration to the Response of a mock.

func NewWireMockResponse

func NewWireMockResponse() *Response

NewWireMockResponse creates and returns a new response.

func (*Response) SetBody

func (r *Response) SetBody(body string)

SetBody adds a body to the response.

func (*Response) SetHeader

func (r *Response) SetHeader(key, value string)

SetHeader adds a header to the response.

func (*Response) SetJSONBody

func (r *Response) SetJSONBody(body interface{}) error

SetBodyJSON marshals an object into a JSON string, sets it as body and add a header in the response.

func (*Response) SetStatus

func (r *Response) SetStatus(status int)

SetStatus adds a status code to the response.

func (*Response) SetTextBody

func (r *Response) SetTextBody(body string) error

SetTextBody sets it as text body and add a header in the response.

type WireMock

type WireMock struct {
	Response *Response `json:"response"`
	Request  *Request  `json:"request"`
	// contains filtered or unexported fields
}

WireMock is a struct to interact with WireMock container.

func NewWireMock

func NewWireMock(serverURI string) *WireMock

NewWireMock creates and returns a new WireMock.

func RegisterWireMockExtension

func RegisterWireMockExtension(s *godog.Suite, serverURI string) *WireMock

RegisterWireMockExtension Register the WireMock management extension

func (*WireMock) Reset

func (w *WireMock) Reset() (err error)

Reset erases all Mocks configured in the WireMockServer.

func (*WireMock) Send

func (w *WireMock) Send() (err error)

Send submits the mock to the WireMockServer.

func (*WireMock) SetWireMockRequest

func (w *WireMock) SetWireMockRequest(request *Request)

SetWireMockRequest adds a request to the object.

func (*WireMock) SetWireMockResponse

func (w *WireMock) SetWireMockResponse(response *Response)

SetWireMockResponse adds a response to the object.

Jump to

Keyboard shortcuts

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