alitest

package module
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 14 Imported by: 0

README

build

alitest

Pragmatique Specification centric Valuable coverage helper

Guide API/Integration test design

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliCookie added in v0.3.7

type AliCookie struct {
	Name     string `json:"name" yaml:"name"`
	Value    string `json:"value" yaml:"value"`
	Path     string `json:"path" yaml:"path"`
	Domain   string `json:"domain" yaml:"domain"`
	Secure   bool   `json:"secure" yaml:"secure"`
	HttpOnly bool   `json:"httpOnly" yaml:"httpOnly"`
}

type AliParameter

type AliParameter struct {
	Value any `json:"value" yaml:"value"`
}

type AliResponse added in v0.3.2

type AliResponse struct {
	// Ignore id array of json pointer string to exclude from check
	Ignore                []string    `json:"ignore" yaml:"ignore"`
	AcceptAdditionalProps bool        `json:"acceptAdditionalProps" yaml:"acceptAdditionalProps"`
	Expected              interface{} `json:"expected" yaml:"expected"`
}

func (AliResponse) Compare added in v0.3.2

func (r AliResponse) Compare(actualPayload []byte) (bool, string)

type ApiComponents

type ApiComponents struct {
	Schemas map[string]interface{} `json:"schemas" yaml:"schemas"`
}

type ApiInfo

type ApiInfo struct {
	Title string `json:"title" yaml:"title"`

	// TODO: determine if I should use it ?
	Summary     string `json:"summary" yaml:"summary"`
	Description string `json:"description" yaml:"description"`
	Version     string `json:"version" yaml:"version"`
}

type IntegrationTestSuite

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

IntegrationTestSuite .... TODO, complete me

func ParseFile

func ParseFile(fileName string) (IntegrationTestSuite, error)

func ParseString

func ParseString(specContent string) (IntegrationTestSuite, error)

func (IntegrationTestSuite) EndpointCount

func (s IntegrationTestSuite) EndpointCount() int

func (*IntegrationTestSuite) Run

func (s *IntegrationTestSuite) Run(t *testing.T, parameters RunParameters)

func (IntegrationTestSuite) String

func (s IntegrationTestSuite) String() string

type OpenApiDocument

type OpenApiDocument struct {
	Info       ApiInfo                `json:"info" yaml:"info"`
	Paths      map[string]OpenApiPath `json:"paths" yaml:"paths"`
	Components ApiComponents          `json:"components" yaml:"components"`
}

type OpenApiOperation

type OpenApiOperation struct {
	Summary     string             `json:"summary" yaml:"summary"`
	Description string             `json:"description" yaml:"description"`
	OperationID string             `json:"operationId" yaml:"operationId"`
	Parameters  []OpenApiParameter `json:"parameters" yaml:"parameters"`
	Responses   OpenApiResponses   `json:"responses" yaml:"responses"`
}

type OpenApiParameter

type OpenApiParameter struct {
	Name        string            `json:"name" yaml:"name"`
	Description string            `json:"description" yaml:"description"`
	In          ParameterLocation `json:"in" yaml:"in"`
	Required    bool              `json:"required" yaml:"required"`
}

type OpenApiPath

type OpenApiPath struct {
	Summary     string            `json:"summary" yaml:"summary"`
	Description string            `json:"description" yaml:"description"`
	Get         *OpenApiOperation `json:"get" yaml:"get"`
	Put         *OpenApiOperation `json:"put" yaml:"put"`
	Post        *OpenApiOperation `json:"post" yaml:"post"`
	Delete      *OpenApiOperation `json:"delete" yaml:"delete"`
	Options     *OpenApiOperation `json:"options" yaml:"options"`
	Head        *OpenApiOperation `json:"head" yaml:"head"`
	Patch       *OpenApiOperation `json:"patch" yaml:"patch"`
	Trace       *OpenApiOperation `json:"trace" yaml:"trace"`
}

func (OpenApiPath) CountOperations

func (p OpenApiPath) CountOperations() int

type OpenApiResponse

type OpenApiResponse struct {
	Description        string                  `json:"description" yaml:"description"`
	Json               OpenApiResponseContent  `json:"application/json" yaml:"application/json"`
	AliParameters      map[string]AliParameter `json:"x-ali-parameters" yaml:"x-ali-parameters"`
	AliBody            interface{}             `json:"x-ali-body" yaml:"x-ali-body"`
	AliResponse        *AliResponse            `json:"x-ali-response" yaml:"x-ali-response"`
	AliRequestCookies  []AliCookie             `json:"x-ali-request-cookies" yaml:"x-ali-request-cookies"`
	AliResponseCookies []AliCookie             `json:"x-ali-response-cookies" yaml:"x-ali-response-cookies"`
}

func (OpenApiResponse) ResolveURL added in v0.3.5

func (o OpenApiResponse) ResolveURL(rawUrl string, params []OpenApiParameter) string

type OpenApiResponseContent

type OpenApiResponseContent struct {
	Schema interface{} `json:"schema" yaml:"schema"`
}

type OpenApiResponses

type OpenApiResponses struct {
	Ok           *OpenApiResponse `json:"200" yaml:"200"`
	Created      *OpenApiResponse `json:"201" yaml:"201"`
	BadRequest   *OpenApiResponse `json:"400" yaml:"400"`
	Unauthorized *OpenApiResponse `json:"401" yaml:"401"`
	NotFound     *OpenApiResponse `json:"404" yaml:"404"`
	Expired      *OpenApiResponse `json:"419" yaml:"419"`
}

type ParameterLocation

type ParameterLocation int
const (
	Query ParameterLocation = iota
	Header
	Path
	Cookie
)

func (ParameterLocation) MarshalJSON

func (i ParameterLocation) MarshalJSON() ([]byte, error)

func (ParameterLocation) String

func (i ParameterLocation) String() string

func (*ParameterLocation) UnmarshalYAML

func (i *ParameterLocation) UnmarshalYAML(data *yaml.Node) (err error)

type RunParameters

type RunParameters struct {
	URL string
}

TODO: doc me

Jump to

Keyboard shortcuts

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