servicetest

package
v0.0.0-...-b33671b Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeData

func EncodeData(data map[string]interface{}, encodedPath string) (encodedData map[string]interface{}, err error)

func EncodeItem

func EncodeItem(item map[string]interface{}) string

func GenerateRandomString

func GenerateRandomString(length int) string

func RandomString

func RandomString(length int, letters []rune) string

func TrimString

func TrimString(input string) string

Types

type ServerTestFeature

type ServerTestFeature struct {
	Engine   *gin.Engine
	Recorder *httptest.ResponseRecorder
	Client   *resty.Client

	ServiceClient abstract_client.AbstractClient

	Response       *http.Response
	ResponseString string
	StatusCode     int

	Token   string
	ID      string
	UserID  int
	APIKey  string
	Message string
	Err     error

	DirectoryFilePath string
	GraphQLOperation  string
	SendFileKey       string
	SendFile          string
	GraphQLResponse   map[string]interface{}
	// contains filtered or unexported fields
}

func NewServerTestFeature

func NewServerTestFeature() *ServerTestFeature

func (*ServerTestFeature) AddDynamicSubstitution

func (s *ServerTestFeature) AddDynamicSubstitution(key string, value SubstitutionFunc)

func (*ServerTestFeature) AddStaticSubstitution

func (s *ServerTestFeature) AddStaticSubstitution(key, value string)

func (*ServerTestFeature) ExtractValueFromResponse

func (s *ServerTestFeature) ExtractValueFromResponse(keyName string) error

func (*ServerTestFeature) FileToSendInRequest

func (s *ServerTestFeature) FileToSendInRequest(filename, directory, key string) error

func (*ServerTestFeature) InitializeScenario

func (s *ServerTestFeature) InitializeScenario(ctx *godog.ScenarioContext)

func (*ServerTestFeature) MakeRequest

func (s *ServerTestFeature) MakeRequest(method string, endpoint string, body *godog.DocString)

func (*ServerTestFeature) PerformRequest

func (s *ServerTestFeature) PerformRequest(method, endpoint string, body []byte)

func (*ServerTestFeature) Reset

func (s *ServerTestFeature) Reset(interface{})

func (*ServerTestFeature) SendGQLRequestWithVariables

func (s *ServerTestFeature) SendGQLRequestWithVariables(gqlMethodName string, serviceName string, endpoint string, variableBody *godog.DocString) error

func (*ServerTestFeature) SendRequest

func (s *ServerTestFeature) SendRequest(method, endpoint string)

func (*ServerTestFeature) SendRequestWithData

func (s *ServerTestFeature) SendRequestWithData(method string, endpoint string, body *godog.DocString)

func (*ServerTestFeature) SetFilePath

func (s *ServerTestFeature) SetFilePath(filename string, directory string) error

func (*ServerTestFeature) ShouldNotContainForJsonQueryPath

func (s *ServerTestFeature) ShouldNotContainForJsonQueryPath(value, jsonQueryPath string) error

func (*ServerTestFeature) TheResponseCodeShouldBe

func (s *ServerTestFeature) TheResponseCodeShouldBe(statusCode int) error

func (*ServerTestFeature) TheResponseHeadersShouldContain

func (s *ServerTestFeature) TheResponseHeadersShouldContain(key, value string)

func (*ServerTestFeature) TheResponseShouldContain

func (s *ServerTestFeature) TheResponseShouldContain(body *godog.DocString)

func (*ServerTestFeature) TheResponseShouldContainA

func (s *ServerTestFeature) TheResponseShouldContainA(key string)

func (*ServerTestFeature) TheResponseShouldContainAThatIsNotNull

func (s *ServerTestFeature) TheResponseShouldContainAThatIsNotNull(jsonQueryPath string) error

func (*ServerTestFeature) TheResponseShouldContainSetTo

func (s *ServerTestFeature) TheResponseShouldContainSetTo(property, value string)

func (*ServerTestFeature) TheResponseShouldMatchJSON

func (s *ServerTestFeature) TheResponseShouldMatchJSON(body *godog.DocString)

func (*ServerTestFeature) TheResponseShouldNotContainA

func (s *ServerTestFeature) TheResponseShouldNotContainA(key string)

func (*ServerTestFeature) WaitForSeconds

func (s *ServerTestFeature) WaitForSeconds(seconds int)

type ServerTestSuite

type ServerTestSuite struct {
	EnvFilePath *string
	Feature     *ServerTestFeature
	Lifecycle   string
	Region      string
	// contains filtered or unexported fields
}

func NewSuite

func NewSuite(config *SuiteConfig) *ServerTestSuite

func (*ServerTestSuite) AddSteps

func (s *ServerTestSuite) AddSteps(steps ...Step)

func (*ServerTestSuite) InitializeScenario

func (s *ServerTestSuite) InitializeScenario(ctx *godog.ScenarioContext)

func (*ServerTestSuite) Run

func (s *ServerTestSuite) Run()

type Step

type Step struct {
	Expression string
	Handler    interface{}
}

type SubstitutionFunc

type SubstitutionFunc func(data []byte) []byte

type SuiteConfig

type SuiteConfig struct {
	Opts          *godog.Options
	ServiceClient graphql_api.PlatformClient
	Engine        *gin.Engine
	Reset         func(sc *godog.Scenario)
	Steps         []Step
}

Jump to

Keyboard shortcuts

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