common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0, BSD-3-Clause, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const Catalog = `` /* 740-byte string literal not displayed */

Variables

This section is empty.

Functions

func ClearReceivedRequests

func ClearReceivedRequests(code *int, response interface{}, server *ghttp.Server)

func Closer

func Closer(s string) io.ReadCloser

func DoHTTP

func DoHTTP(reaction *HTTPReaction, checks *HTTPExpectations) func(*http.Request) (*http.Response, error)

func FakeBrokerServer

func FakeBrokerServer(code *int, response interface{}) *ghttp.Server

func LoadEnvironment

func LoadEnvironment(confgiFileDir string) env.Environment

func MapContains

func MapContains(actual Object, expected Object)

func RegisterBroker

func RegisterBroker(brokerJSON Object, SM *httpexpect.Expect) string

func RegisterPlatform

func RegisterPlatform(platformJSON Object, SM *httpexpect.Expect) *types.Platform

func RemoveAllBrokers

func RemoveAllBrokers(SM *httpexpect.Expect)

func RemoveAllPlatforms

func RemoveAllPlatforms(SM *httpexpect.Expect)

func SetupFakeFailingBrokerServer

func SetupFakeFailingBrokerServer(brokerID string) *httptest.Server

func SetupFakeServiceBrokerServer

func SetupFakeServiceBrokerServer(brokerID string) *httptest.Server

func SetupFakeServiceBrokerServerWithPrefix

func SetupFakeServiceBrokerServerWithPrefix(brokerID, prefix string) *httptest.Server

func VerifyBrokerCatalogEndpointInvoked

func VerifyBrokerCatalogEndpointInvoked(server *ghttp.Server, times int)

func VerifyReqReceived

func VerifyReqReceived(server *ghttp.Server, times int, method, path string, rawQuery ...string)

Types

type Array

type Array = []interface{}

type Broker

type Broker struct {
	StatusCode     int
	ResponseBody   []byte
	Request        *http.Request
	RequestBody    *httpexpect.Value
	RawRequestBody []byte
	OSBURL         string
	Server         *httptest.Server
	ID             string
}

func (*Broker) Called

func (b *Broker) Called() bool

func (*Broker) ServeHTTP

func (b *Broker) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type ContextParams

type ContextParams struct {
	Environment        env.Environment
	RegisterExtensions func(api *web.API)
	DefaultTokenClaims map[string]interface{}
}

type HTTPExpectations

type HTTPExpectations struct {
	URL     string
	Body    string
	Params  map[string]string
	Headers map[string]string
}

type HTTPReaction

type HTTPReaction struct {
	Status int
	Body   string
	Err    error
}

type NopCloser

type NopCloser struct {
	io.Reader
}

func (NopCloser) Close

func (NopCloser) Close() error

type OAuthServer

type OAuthServer struct {
	URL string
	// contains filtered or unexported fields
}

func NewOAuthServer

func NewOAuthServer() *OAuthServer

func (*OAuthServer) Close

func (os *OAuthServer) Close()

func (*OAuthServer) CreateToken

func (os *OAuthServer) CreateToken(payload map[string]interface{}) string

func (*OAuthServer) Start

func (os *OAuthServer) Start()

type Object

type Object = map[string]interface{}

func MakeBroker

func MakeBroker(name string, url string, description string) Object

func MakePlatform

func MakePlatform(id string, name string, atype string, description string) Object

type TestContext

type TestContext struct {
	SM          *httpexpect.Expect
	SMWithOAuth *httpexpect.Expect
	SMWithBasic *httpexpect.Expect

	OAuthServer *OAuthServer
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(params *ContextParams) *TestContext

func (*TestContext) Cleanup

func (ctx *TestContext) Cleanup()

func (*TestContext) CleanupBroker

func (ctx *TestContext) CleanupBroker(name string)

func (*TestContext) RegisterBroker

func (ctx *TestContext) RegisterBroker(name string, server *httptest.Server) *Broker

Jump to

Keyboard shortcuts

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