testhelper

package module
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 21 Imported by: 0

README

Test helper

Documentation

Overview

Хелпер для теста приложения в целом

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(home string, fileName string, env misc.StringMap, cfg any) (err error)

Загрузка конфига приложения

func Rest added in v0.1.5

func Rest(t *testing.T, data *Data)

func SetLiveTest added in v0.1.9

func SetLiveTest(h *stdhttp.HTTP, proc LiveTestProcessor) (err error)

func Start

func Start(t *testing.T, home string, fileName string, env misc.StringMap, cfg config.App) (err error)

Запуск теста

func Stop

func Stop(code int)

Заканчиваем работу

Types

type Call added in v0.1.5

type Call struct {
	// In
	Method        string
	RequestHeader http.Header
	URI           string
	Body          []byte

	// Out
	ID             uint64
	ResponseHeader http.Header
	Status         int
	Answer         []byte
}

func (*Call) Header added in v0.1.5

func (call *Call) Header() (h http.Header)

func (*Call) Write added in v0.1.5

func (call *Call) Write(data []byte) (n int, err error)

func (*Call) WriteHeader added in v0.1.5

func (call *Call) WriteHeader(statusCode int)

type Data added in v0.1.5

type Data struct {
	Cfg     config.App
	Init    Init
	CfgPath string
	Calls   []*Call
}

type Init added in v0.1.5

type Init func(any) (hh *stdhttp.HTTP, err error)

type LiveTestProcessor added in v0.1.9

type LiveTestProcessor func(id uint64, prefix string, path string, w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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