mock

package
v0.0.0-...-034a78d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(t *testing.T, httpHandler *HTTPHandler)

DoRequest helps test that whether the http response with the given method,url,requestJSON,handlerFunc matches with the expectHTTPCode and expectResponse. if false the test will be not failed

func Test

func Test(t *testing.T)

Test register test suite

Types

type EtcdCluster

type EtcdCluster struct {
	Endpoints []string
	// contains filtered or unexported fields
}

EtcdCluster mock etcd cluster for testing

func StartEtcdCluster

func StartEtcdCluster(t *testing.T) *EtcdCluster

StartEtcdCluster starts integration etcd cluster

func (*EtcdCluster) Terminate

func (etcd *EtcdCluster) Terminate(t *testing.T)

Terminate terminates integration etcd cluster

type HTTPHandler

type HTTPHandler struct {
	Method      string
	URL         string
	RequestBody interface{}

	HandlerFunc http.HandlerFunc

	ExpectHTTPCode int
	ExpectResponse interface{}
}

HTTPHandler represents amock http handler

type RepoTestSuite

type RepoTestSuite struct {
	Cluster *EtcdCluster
}

RepoTestSuite represents repo test suite init integration etcd cluster

func (*RepoTestSuite) SetUpSuite

func (ts *RepoTestSuite) SetUpSuite(c *check.C)

SetUpSuite setups test suite

func (*RepoTestSuite) TearDownSuite

func (ts *RepoTestSuite) TearDownSuite(c *check.C)

TearDownSuite teardowns test suite, release resource

Jump to

Keyboard shortcuts

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