testhelpers

package
v14.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KasUserAgent                            = "kas/v0.1-blabla/asdwd"
	KasCorrelationClientName                = "gitlab-kas-test"
	AgentkToken              api.AgentToken = "123123"
	AuthSecretKey                           = "blablabla"

	CorrelationIdHeader         = "X-Request-ID"
	CorrelationClientNameHeader = "X-GitLab-Client-Name"

	AgentId   int64 = 123
	ProjectId int64 = 321
)

Variables

This section is empty.

Functions

func AgentInfoObj

func AgentInfoObj() *api.AgentInfo

func AssertAgentToken

func AssertAgentToken(t *testing.T, r *http.Request, agentToken api.AgentToken)

func AssertCommonRequestParams

func AssertCommonRequestParams(t *testing.T, r *http.Request, correlationId string)

func AssertGetJsonRequest

func AssertGetJsonRequest(t *testing.T, r *http.Request)

func AssertGetJsonRequestIsCorrect

func AssertGetJsonRequestIsCorrect(t *testing.T, r *http.Request, correlationId string)

func AssertGetRequestIsCorrect

func AssertGetRequestIsCorrect(t *testing.T, r *http.Request, correlationId string)

func AssertInvalid

func AssertInvalid(t *testing.T, tests []InvalidTestcase)

func AssertJWTSignature

func AssertJWTSignature(t *testing.T, r *http.Request)

func AssertRequestAccept

func AssertRequestAccept(t *testing.T, r *http.Request, accept string)

func AssertRequestAcceptJson

func AssertRequestAcceptJson(t *testing.T, r *http.Request)

func AssertRequestContentTypeJson

func AssertRequestContentTypeJson(t *testing.T, r *http.Request)

func AssertRequestMethod

func AssertRequestMethod(t *testing.T, r *http.Request, method string)

func AssertRequestUserAgent

func AssertRequestUserAgent(t *testing.T, r *http.Request, userAgent string)

func AssertValid

func AssertValid(t *testing.T, tests []ValidTestcase)

func CtxWithCorrelation

func CtxWithCorrelation(t *testing.T) (context.Context, string)

func NewPollConfig added in v14.2.0

func NewPollConfig(interval time.Duration) retry.PollConfigFactory

func RecvMsg

func RecvMsg(value interface{}) func(interface{})

func RespondWithJSON

func RespondWithJSON(t *testing.T, w http.ResponseWriter, response interface{})

func SetValue

func SetValue(target, value interface{})

SetValue sets target to value. target must be a pointer. i.e. *blaProtoMsgType value must of the same type as target.

Types

type InvalidTestcase

type InvalidTestcase struct {
	ErrString string
	Invalid   Validatable
}

type ValidTestcase

type ValidTestcase struct {
	Name  string
	Valid Validatable
}

type Validatable

type Validatable interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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