test

package
v0.0.0-...-5a98790 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package test contains useful functions used across tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertError

func AssertError(t *testing.T, err error) *xerror.Error

AssertError validates that given error is of an instance of xerror.Error. If so, returns the instance of xerror.Error.

func AssertStatusCode

func AssertStatusCode(t *testing.T, expectedStatusCode int, srv http.Handler, req *http.Request)

AssertStatusCode checks if the given request returns the expected status code.

func DebugLogger

func DebugLogger() xlog.Logger

DebugLogger creates a xlog.Logger with xlog.DebugLevel for our tests.

func DummyEchoContext

func DummyEchoContext() echo.Context

DummyEchoContext creates a echo.Context without anything.

func EchoContextMultipart

func EchoContextMultipart(t *testing.T) echo.Context

EchoContextMultipart creates a echo.Context with form files.

func ErrorLogger

func ErrorLogger() xlog.Logger

ErrorLogger creates a xlog.Logger with xlog.ErrorLevel for our tests.

func GenerateDestination

func GenerateDestination() string

GenerateDestination simply generates a path for a resulting PDF file.

func HTMLFpaths

func HTMLFpaths(t *testing.T) []string

HTMLFpaths return the paths of all files under "testdata/html" folder.

func HTMLMultipartForm

func HTMLMultipartForm(t *testing.T, formValues map[string]string) (*bytes.Buffer, string)

HTMLMultipartForm returns the body for a multipart/form-data request with all files under "testdata/html" folder.

func InfoLogger

func InfoLogger() xlog.Logger

InfoLogger creates a xlog.Logger with xlog.InfoLevel for our tests.

func MarkdownFpaths

func MarkdownFpaths(t *testing.T) []string

MarkdownFpaths return the paths of all files under "testdata/markdown" folder.

func MarkdownMultipartForm

func MarkdownMultipartForm(t *testing.T, formValues map[string]string) (*bytes.Buffer, string)

MarkdownMultipartForm returns the body for a multipart/form-data request with all files under "testdata/markdown" folder.

func MergeFpaths

func MergeFpaths(t *testing.T) []string

MergeFpaths return the paths of all files under "testdata/pdf" folder.

func MergeMultipartForm

func MergeMultipartForm(t *testing.T, formValues map[string]string) (*bytes.Buffer, string)

MergeMultipartForm returns the body for a multipart/form-data request with all files under "testdata/pdf" folder.

func OfficeFpaths

func OfficeFpaths(t *testing.T) []string

OfficeFpaths return the paths of all files under "testdata/office" folder.

func OfficeMultipartForm

func OfficeMultipartForm(t *testing.T, formValues map[string]string) (*bytes.Buffer, string)

OfficeMultipartForm returns the body for a multipart/form-data request with all files under "testdata/office" folder.

func URLFpaths

func URLFpaths(t *testing.T) []string

URLFpaths return the paths of all files under "testdata/url" folder.

func URLMultipartForm

func URLMultipartForm(t *testing.T, formValues map[string]string) (*bytes.Buffer, string)

URLMultipartForm returns the body for a multipart/form-data request with all files under "testdata/url" folder.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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