test

package
v0.0.0-...-a7707e3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestAPTestCaseFactory

func RestAPTestCaseFactory(t *testing.T) func(config *RestAPITestCaseConfig) RestAPITestCase

RestAPTestCaseFactory HTTP configuration: Request and Response

func RestMockTestCaseFactory

func RestMockTestCaseFactory(t *testing.T) func(name string, request RestMockTestCaseRequest, response RestMockTestCaseResponse) RestMockTestCase

RestMockTestCaseFactory HTTP configuration: Request and Response

func SendFile

func SendFile(t *testing.T, router router.IRouter, path string, fileName string) models.File

SendFile Sends file as form to /_api/files API

Types

type ErrorHolder

type ErrorHolder struct {
	// contains filtered or unexported fields
}

ErrorHolder Error Holder object

func NewErrorHolder

func NewErrorHolder() ErrorHolder

NewErrorHolder Error Holder

func (*ErrorHolder) Group

func (holder *ErrorHolder) Group(groupName string) func(message string, level int) *errorGroup

Group Error Holder creationg group

func (*ErrorHolder) HasErrors

func (holder *ErrorHolder) HasErrors() bool

HasErrors Error Holder has errors

func (*ErrorHolder) Print

func (holder *ErrorHolder) Print(t *testing.T)

Print Print all errors

type RestAPITestCase

type RestAPITestCase struct {
	RestAPITestCaseConfig
	// contains filtered or unexported fields
}

RestAPITestCase HTTP Test Case

func (*RestAPITestCase) AssertEquals

func (testCase *RestAPITestCase) AssertEquals(response *httptest.ResponseRecorder)

AssertEquals checking Router Response

func (RestAPITestCase) TransformToHTTPResponseRequest

func (testCase RestAPITestCase) TransformToHTTPResponseRequest() (*httptest.ResponseRecorder, *http.Request)

TransformToHTTPResponseRequest Generate Request and Response for Router

type RestAPITestCaseConfig

type RestAPITestCaseConfig struct {
	Name                string
	Method              string
	Status              int
	URI                 string
	RequestFile         string
	RequestFileIsSource bool
	ResponseFile        string
	ExpectedResponse    interface{}
	ActualResponse      interface{}
}

RestAPITestCaseConfig HTTP Test Case Config

type RestMockTestCase

type RestMockTestCase struct {
	// contains filtered or unexported fields
}

RestMockTestCase HTTP Test Case

func (*RestMockTestCase) AssertEquals

func (testCase *RestMockTestCase) AssertEquals(response *httptest.ResponseRecorder)

AssertEquals checking Router Response

func (RestMockTestCase) TransformToHTTPResponseRequest

func (testCase RestMockTestCase) TransformToHTTPResponseRequest() (*httptest.ResponseRecorder, *http.Request)

TransformToHTTPResponseRequest Generate Request and Response for Router

type RestMockTestCaseRequest

type RestMockTestCaseRequest struct {
	Type    string
	Path    string
	Headers map[string]string
	Body    string
}

RestMockTestCaseRequest HTTP Request structure

type RestMockTestCaseResponse

type RestMockTestCaseResponse struct {
	Status   int
	Headers  map[string]string
	Body     string
	BodyFile string
}

RestMockTestCaseResponse HTTP Response structure

Jump to

Keyboard shortcuts

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