testSuit

package module
v0.0.0-...-105714e Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2017 License: MIT Imports: 16 Imported by: 0

README

goTest

personal test tool for gin based http server

Go Report Card

Usage

var (
	caseOne = conf.NewCaseOne("develop")
	App     = setApp()
)

func setApp() *gin.Engine {
	r := testSuit.GetGinEngine()
	api.NewApp(caseOne)
	api.SetRouter(r)
	return r
}

func TestPing(*testing.T) {
	suit := &testSuit.TestSuit{
		Router: App,
		Method: "GET",
		URL:    "/ping",
	}

	resp := suit.Do()
	assert.Equal(t, 200, resp.Code)
}

Other function

// generate the random color image
func GenImage(ext string, width, height int) (*bytes.Buffer, string, error) {}

// return gin engine with test mode
func GetGinEngine() *gin.Engine {}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenImage

func GenImage(ext string, width, height int) (*bytes.Buffer, string, error)

GenImage generate randomize image

func GetGinEngine

func GetGinEngine() *gin.Engine

GetGinEngine create gin.Engine with test mode

Types

type TestSuit

type TestSuit struct {
	Method      string
	URL         string
	Data        url.Values
	Buffer      io.Reader
	ContentType string

	Header map[string]string
	Router *gin.Engine
	// contains filtered or unexported fields
}

TestSuit http request test form

func (*TestSuit) Do

Do start test

Jump to

Keyboard shortcuts

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