integration

package
v0.0.0-...-2c24670 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAction

func AssertAction(t *testing.T, meta JSONAPIRespMeta, names ...string)

AssertAction ...

func AssertAttr

func AssertAttr(t *testing.T, i interface{}, m map[string]interface{})

AssertAttr ...

func AssertGetOK

func AssertGetOK(t *testing.T, path string, token string) (resp gorequest.Response, body string, errs []error)

AssertGetOK assert GET request is OK

func AssertLink(t *testing.T, i interface{}, names ...string)

AssertLink ...

func AssertNoAction

func AssertNoAction(t *testing.T, meta JSONAPIRespMeta, names ...string)

AssertNoAction ...

func AssertNoLink(t *testing.T, i interface{}, names ...string)

AssertNoLink ...

func AssertStatusNotFound

func AssertStatusNotFound(t *testing.T, resp gorequest.Response)

AssertStatusNotFound assert response status code is 404

func AssertStatusOK

func AssertStatusOK(t *testing.T, resp gorequest.Response)

AssertStatusOK assert response status code is OK

func AssertStatusSuccess

func AssertStatusSuccess(t *testing.T, resp gorequest.Response)

AssertStatusSuccess assert response code is success

func AssertStatusUnauthorized

func AssertStatusUnauthorized(t *testing.T, resp gorequest.Response)

AssertStatusUnauthorized assert response status code is 401

func Request

func Request(method string, path string, token string) (req *gorequest.SuperAgent)

Request generic json api request with optional auth token

Types

type AuthRequester

type AuthRequester struct {
	Requester
	// contains filtered or unexported fields
}

func NewAuthRequester

func NewAuthRequester(t *testing.T, userId int) *AuthRequester

func (*AuthRequester) GetList

func (r *AuthRequester) GetList(path string) (gorequest.Response, *JSONAPIManyResp, []error)

type JSONAPIManyResp

type JSONAPIManyResp struct {
	Data     []JSONAPIRespData      `json:"data"`
	Meta     JSONAPIRespMeta        `json:"meta"`
	Errors   []*jsonapi.ErrorObject `json:"errors"`
	Included []JSONAPIRespData
}

JSONAPIManyResp ...

func GetList

func GetList(t *testing.T, path string, token string) (gorequest.Response, *JSONAPIManyResp, []error)

GetList jsonapi get list request

type JSONAPIOneResp

type JSONAPIOneResp struct {
	Data     JSONAPIRespData        `json:"data"`
	Errors   []*jsonapi.ErrorObject `json:"errors"`
	Included []JSONAPIRespData
}

JSONAPIOneResp ...

func Delete

func Delete(t *testing.T, path string, token string) (gorequest.Response, *JSONAPIOneResp, []error)

Delete jsonapi delete request

func Get

func Get(t *testing.T, path string, token string) (gorequest.Response, *JSONAPIOneResp, []error)

Get jsonapi get request

func Patch

func Patch(t *testing.T, path string, attrs map[string]interface{}, token string) (gorequest.Response, *JSONAPIOneResp, []error)

Patch jsonapi patch request

func Post

func Post(t *testing.T, path string, attrs map[string]interface{}, token string) (gorequest.Response, *JSONAPIOneResp, []error)

Post jsonapi post request

type JSONAPIRespData

type JSONAPIRespData struct {
	ID            string
	Type          string
	Attributes    interface{}     `json:"attributes"`
	Meta          JSONAPIRespMeta `json:"meta"`
	Links         interface{}     `json:"links"`
	Relationships interface{}
}

JSONAPIRespData ...

type JSONAPIRespMeta

type JSONAPIRespMeta struct {
	Actions []meta.JsonAPIAction
}

JSONAPIRespMeta ...

type Requester

type Requester struct {
}

Jump to

Keyboard shortcuts

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