testhelpers

package
v1.4.0-apireorg.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(in string, out string)

CopyFile copys content of in into file name out

func Dates

func Dates() (min time.Time, max time.Time, df string)

Dates generate min, max and data formats that we use

func Dir

func Dir() (dir string)

Dir generates a temp directory, upto user to delete directory

func MockServer

func MockServer(f func(w http.ResponseWriter, r *http.Request), loglevel string) *httptest.Server

MockServer generates a mockserver with a handler attached and sets the log level

func Mux

func Mux() *http.ServeMux

Mux test

func T

func T() *timer.Ts

T provides a quick timer method from timer package

func WRGet

func WRGet(route string) (*httptest.ResponseRecorder, *http.Request)

WRGet returns test http

Types

type Nested added in v1.0.0

type Nested struct {
	ID   string  `json:"id"`
	Who  *Simple `json:"who"`
	When *Ts     `json:"ts"`
}

type Simple

type Simple struct {
	Name string `json:"name"`
}

type Ts

type Ts struct {
	S time.Time `json:"start"`
	E time.Time `json:"end"`
}

Ts is a test struct

func NewT added in v1.0.0

func NewT() *Ts

Jump to

Keyboard shortcuts

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