testing

package
v0.0.0-...-ed65269 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReadStdout func() string

ReadStdout value

View Source
var ResetStdout func()

ResetStdout back to os.Stdout

Functions

func BeforeOnce

func BeforeOnce(beforeBlock func())

BeforeOnce runs the before each block only once

func Delete

func Delete(app *api.App, url string) (int, string)

Delete from server

func FHTTPMeasure

func FHTTPMeasure(description string, setup func(map[string]interface{}), f func(string, map[string]interface{}), timeout float64) bool

FHTTPMeasure runs the specified specs in an http test

func FastDelete

func FastDelete(url string) (int, []byte, error)

FastDelete performs a DELETE on an URL

func FastGet

func FastGet(url string) (int, []byte, error)

FastGet performs a GET on an URL

func FastPatchTo

func FastPatchTo(url string, payload []byte) (int, []byte, error)

FastPatchTo performs a PATCH on an URL

func FastPostTo

func FastPostTo(url string, payload []byte) (int, []byte, error)

FastPostTo performs a POST on an URL

func FastPutTo

func FastPutTo(url string, payload []byte) (int, []byte, error)

FastPutTo performs a PUT on an URL

func Get

func Get(app *api.App, url string, headersKv ...string) (int, string)

Get from server

func GetDefaultTestApp

func GetDefaultTestApp() *api.App

GetDefaultTestApp returns a testing app

func GetDefaultTestAppWithFaultyRedis

func GetDefaultTestAppWithFaultyRedis() *api.App

GetDefaultTestAppWithFaultyRedis returns a new podium API Application bound to 0.0.0.0:8890 for test but with a failing Redis

func GetRoute

func GetRoute(httpEndPoint string, url string) string

GetRoute returns the endpoint for accessing an url in an app

func GetTestingRedis

func GetTestingRedis(app *api.App) (redis.Client, error)

GetTestingRedis creates a redis instance based on the default app configuration

func HTTPMeasure

func HTTPMeasure(description string, setup func(map[string]interface{}), f func(string, map[string]interface{}), timeout float64) bool

HTTPMeasure runs the specified specs in an http test

func InitializeTestServer

func InitializeTestServer(app *api.App)

InitializeTestServer starts the test server

func MockStdout

func MockStdout()

MockStdout to read it's value later

func NewEmptyCtx

func NewEmptyCtx() context.Context

NewEmptyCtx Creates an empty context (shortcut for context.Background())

func Patch

func Patch(app *api.App, url, body string) (int, string)

Patch to server

func PatchJSON

func PatchJSON(app *api.App, url string, body interface{}) (int, string)

PatchJSON to server

func Post

func Post(app *api.App, url, body string) (int, string)

Post to server

func PostJSON

func PostJSON(app *api.App, url string, body interface{}) (int, string)

PostJSON to server

func Put

func Put(app *api.App, url, body string) (int, string)

Put to server

func PutJSON

func PutJSON(app *api.App, url string, body interface{}) (int, string)

PutJSON to server

func SetupGRPC

func SetupGRPC(app *api.App, f func(pb.PodiumClient))

SetupGRPC sets up the environment for grpc communication, starting the app and creating a connected client

func ShutdownDefaultTestApp

func ShutdownDefaultTestApp()

ShutdownDefaultTestApp turn off default test app

func ShutdownDefaultTestAppWithFaltyRedis

func ShutdownDefaultTestAppWithFaltyRedis()

ShutdownDefaultTestAppWithFaltyRedis turn off default test app

func XHTTPMeasure

func XHTTPMeasure(description string, setup func(map[string]interface{}), f func(string, map[string]interface{}), timeout float64) bool

XHTTPMeasure runs the specified specs in an http test

Types

type TestBuffer

type TestBuffer struct {
	bytes.Buffer
}

TestBuffer is a mock buffer

func (*TestBuffer) Lines

func (b *TestBuffer) Lines() []string

Lines returns all lines of log

func (*TestBuffer) Stripped

func (b *TestBuffer) Stripped() string

Stripped removes new lines

func (*TestBuffer) Sync

func (b *TestBuffer) Sync() error

Sync does nothing

Jump to

Keyboard shortcuts

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