gobank

package module
v0.0.0-...-0663bbf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 8 Imported by: 0

README

GoBank

GoBank -- Go client for the awesome, over-the-wire test double Mountebank.

THIS PROJECT IS CURRENTLY UNDER DEVELOPMENT.

ALTHOUGH MOST OF THE HTTP IMPOSTER FUNCTIONALITY IS COVERED, THE FLUENT API MIGHT CHANGE.

PLEASE CHECK AGAIN LATER...

Installation

$ go get github.com/durmaze/gobank

Documentation

See Go Doc or Go Walker for usage and details.

Status

TODO Add Travis Build Status, Go coverage, GoDoc, License, etc.

Why should you use GoBank?

GoBank makes things simple if you'd like to use Mountebank in your tests. As recommended by Mountebank, you're better off creating and deleting your imposters in your test lifecycle (i.e. setup and teardown hooks).

GoBank provides a Go API, which directly maps to Mountebank's REST API.

With GoBank, you can simply create an Imposter via a Fluent API,

// build an Imposter
imposter := NewImposterBuilder().Protocol("http").Port(4546).Build()

and then, you can publish your imposter to Mountebank.

// publish your Imposter to Mountebank
client := mountebank.NewClient(MountebankUri)
client.CreateImposter(imposter)

Contributing to GoBank:

If you want to contribute, feel free to send me a pull request with testing.

Currently, only HTTP imposters are supported. Any contributions on HTTPS, SMTP and TCP are more than welcome.

Thanks to all contributors thus far: @alperkose

License

GoBank is MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(mountebankURI string) *Client

func (*Client) CreateImposter

func (c *Client) CreateImposter(imposter ImposterElement) (map[string]interface{}, error)

func (*Client) DeleteAllImposters

func (c *Client) DeleteAllImposters() (map[string]interface{}, error)

func (*Client) DeleteImposter

func (c *Client) DeleteImposter(port int) (map[string]interface{}, error)

func (*Client) Logs

func (c *Client) Logs() ([]Log, error)

type ImposterBuilder

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

func NewImposterBuilder

func NewImposterBuilder() *ImposterBuilder

func (*ImposterBuilder) Build

func (builder *ImposterBuilder) Build() ImposterElement

func (*ImposterBuilder) Mode

func (builder *ImposterBuilder) Mode(mode string) *ImposterBuilder

func (*ImposterBuilder) Name

func (builder *ImposterBuilder) Name(name string) *ImposterBuilder

func (*ImposterBuilder) Port

func (builder *ImposterBuilder) Port(port int) *ImposterBuilder

func (*ImposterBuilder) Protocol

func (builder *ImposterBuilder) Protocol(protocol string) *ImposterBuilder

func (*ImposterBuilder) Record

func (builder *ImposterBuilder) Record(record bool) *ImposterBuilder

func (*ImposterBuilder) Stubs

func (builder *ImposterBuilder) Stubs(stubs ...StubElement) *ImposterBuilder

type ImposterElement

type ImposterElement struct {
	Protocol string        `json:"protocol"`
	Port     int           `json:"port,omitempty"`
	Name     string        `json:"name,omitempty"`
	Mode     string        `json:"mode,omitempty"`
	Record   bool          `json:"recordRequests,omitempty"`
	Stubs    []StubElement `json:"stubs,omitempty"`
}

type Log

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

type StubBuilder

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

func Stub

func Stub() *StubBuilder

func (*StubBuilder) Build

func (builder *StubBuilder) Build() StubElement

func (*StubBuilder) Predicates

func (builder *StubBuilder) Predicates(predicates ...predicates.Predicate) *StubBuilder

func (*StubBuilder) Responses

func (builder *StubBuilder) Responses(responses ...responses.Response) *StubBuilder

type StubElement

type StubElement struct {
	Responses  []responses.Response   `json:"responses"`
	Predicates []predicates.Predicate `json:"predicates"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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