Back to godoc.org

Package test

v0.0.0-...-4e7f540
Latest Go to latest

The highest tagged major version is .

Published: Sep 21, 2020 | License: MIT | Module: github.com/thecodingmachine/gotenberg

Overview

Package test contains useful functions used across tests.

Index

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier