kztest

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 13 Imported by: 0

README

kztest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeCurrentWorkDir

func ChangeCurrentWorkDir(lvl int)

func HTTPTestJSONEncode

func HTTPTestJSONEncode(t *testing.T, v any) (ret string)

func RunHTTPTests

func RunHTTPTests(t *testing.T, httpHandler http.Handler, tkits []HTTPTestKit)

func RunTests

func RunTests(t *testing.T, functions any, tkits []TestKit)

Types

type HTTPTestKit

type HTTPTestKit struct {
	Request                  HTTPTestKitRequest
	Response                 HTTPTestKitResponse
	BeforePerformRequestFunc func(t *testing.T, req *http.Request, tkit *HTTPTestKit)
	AfterPerformRequestFunc  func(t *testing.T, req *http.Request, resp *http.Response, tkit *HTTPTestKit)
}

type HTTPTestKitRequest

type HTTPTestKitRequest struct {
	Method          string
	Target          string
	Headers         map[string]string
	Body            string
	BodyMakeFunc    func(t *testing.T, tkit *HTTPTestKit) string
	HeadersMakeFunc func(t *testing.T, tkit *HTTPTestKit) map[string]string
}

type HTTPTestKitResponse

type HTTPTestKitResponse struct {
	StatusCode    int
	Headers       map[string]string
	Body          string
	BodyCheckFunc func(t *testing.T, respBody string, tkit *HTTPTestKit) bool
}

type TestKit

type TestKit struct {
	Arg  any
	Arg1 any
	Arg2 any
	Arg3 any
	Arg4 any
	Arg5 any
	Arg6 any
	Arg7 any
	Args []any

	Result  any
	Result1 any
	Result2 any
	Result3 any
	Result4 any
	Result5 any
	Result6 any
	Result7 any
	Results []any
}

Jump to

Keyboard shortcuts

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