servicetest

package
v0.0.0-...-fcf82ef Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 37 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 GenerateRandomPassword

func GenerateRandomPassword() 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 FileToSend

type FileToSend struct {
	Key  string
	Path string
}

type ServerTestFeature

type ServerTestFeature struct {
	BeforeRequest func(body []byte)
	Engine        *gin.Engine
	Recorder      *httptest.ResponseRecorder
	Client        *resty.Client

	UDPConn              *net.UDPConn
	WebsocketConn        *websocket.Conn
	WebsocketReadTimeout *time.Duration

	ServiceClient  abstract.AbstractClient
	PlatformClient platform.Client

	HTTPResponse   *http.Response
	ResponseString string
	StatusCode     int

	RandomInt int
	UUID      string

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

	DirectoryFilePath string
	GraphQLOperation  string
	FilesToSend       []FileToSend
	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) CheckMessageNotEmpty

func (s *ServerTestFeature) CheckMessageNotEmpty() error

func (*ServerTestFeature) CompareFiles

func (s *ServerTestFeature) CompareFiles(file1, file2, dir string) error

func (*ServerTestFeature) CompareFilesForInequality

func (s *ServerTestFeature) CompareFilesForInequality(file1, file2, dir string) error

func (*ServerTestFeature) CreateRandomInt

func (s *ServerTestFeature) CreateRandomInt()

func (*ServerTestFeature) CreateRandomUUID

func (s *ServerTestFeature) CreateRandomUUID() error

func (*ServerTestFeature) DownloadFile

func (s *ServerTestFeature) DownloadFile(filepath, url string) error
func (s *ServerTestFeature) DownloadFileViaLink(keyName, downloadDirectory, filename string) error

func (*ServerTestFeature) ExtractValueFromResponse

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

func (*ServerTestFeature) ExtractValueFromResponseAs

func (s *ServerTestFeature) ExtractValueFromResponseAs(keyName, identifier string) error

func (*ServerTestFeature) FileShouldExist

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

func (*ServerTestFeature) FileToSendInRequest

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

func (*ServerTestFeature) GetWebsocketMessage

func (s *ServerTestFeature) GetWebsocketMessage() error

func (*ServerTestFeature) InitializeScenario

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

func (*ServerTestFeature) MakeGraphQLRequest

func (s *ServerTestFeature) MakeGraphQLRequest(endpoint, serviceName, body string) error

func (*ServerTestFeature) MakeRequest

func (s *ServerTestFeature) MakeRequest(method, tenant, service, endpoint string, body *godog.DocString, paramsMap map[string]string) error

func (*ServerTestFeature) OpenWebsocket

func (s *ServerTestFeature) OpenWebsocket(endpoint string) error

func (*ServerTestFeature) PerformRequest

func (s *ServerTestFeature) PerformRequest(method, tenant, service, endpoint string, body []byte, paramsMap map[string]string) error

func (*ServerTestFeature) PerformSubstitutions

func (s *ServerTestFeature) PerformSubstitutions(data []byte) []byte

func (*ServerTestFeature) Reset

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

func (*ServerTestFeature) ResponseContainsItemAtIndexWithPropertyNotSetToNull

func (s *ServerTestFeature) ResponseContainsItemAtIndexWithPropertyNotSetToNull(index int, property string) error

func (*ServerTestFeature) ResponseContainsItemAtIndexWithPropertyOfLength

func (s *ServerTestFeature) ResponseContainsItemAtIndexWithPropertyOfLength(index int, property string, length int) error

func (*ServerTestFeature) ResponseContainsItemAtIndexWithPropertySetTo

func (s *ServerTestFeature) ResponseContainsItemAtIndexWithPropertySetTo(index int, property, value string) error

func (*ServerTestFeature) ResponseContainsItemAtIndexWithPropertySetToNull

func (s *ServerTestFeature) ResponseContainsItemAtIndexWithPropertySetToNull(index int, property string) error

func (*ServerTestFeature) ResponseContainsItemWithPropertySetTo

func (s *ServerTestFeature) ResponseContainsItemWithPropertySetTo(property, value string) error

func (*ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertyNotNull

func (s *ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertyNotNull(objectName string, index int, property string) error

func (*ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertyOfLength

func (s *ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertyOfLength(objectName string, index int, property string, length int) error

func (*ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertySetTo

func (s *ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertySetTo(objectName string, index int, property, value string) error

func (*ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertySetToNull

func (s *ServerTestFeature) ResponseContainsObjectWithItemAtIndexWithPropertySetToNull(objectName string, index int, property string) error

func (*ServerTestFeature) ResponseContainsObjectWithPropertySetTo

func (s *ServerTestFeature) ResponseContainsObjectWithPropertySetTo(objectName, property, value string) error

func (*ServerTestFeature) ResponseShouldContainPropertyWithLength

func (a *ServerTestFeature) ResponseShouldContainPropertyWithLength(jsonQueryPath string, length int) error

func (*ServerTestFeature) ResponseShouldHaveLength

func (s *ServerTestFeature) ResponseShouldHaveLength(length int) error

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) error

func (*ServerTestFeature) SendRequestToService

func (s *ServerTestFeature) SendRequestToService(method, tenant, service, endpoint string) error

func (*ServerTestFeature) SendRequestWithData

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

func (*ServerTestFeature) SendRequestWithDataToService

func (s *ServerTestFeature) SendRequestWithDataToService(method, tenant, service, endpoint string, body *godog.DocString) error

func (*ServerTestFeature) SendRequestWithEncodedData

func (s *ServerTestFeature) SendRequestWithEncodedData(method, endpoint, encodedPath string, body *godog.DocString) error

func (*ServerTestFeature) SendRequestWithEncodedDataToService

func (s *ServerTestFeature) SendRequestWithEncodedDataToService(method, tenant, service, endpoint, encodedPath string, body *godog.DocString) error

func (*ServerTestFeature) SendRequestWithParams

func (s *ServerTestFeature) SendRequestWithParams(method, endpoint string, params *godog.DocString) error

func (*ServerTestFeature) SendRequestWithParamsToService

func (s *ServerTestFeature) SendRequestWithParamsToService(method, tenant, service, endpoint string, params *godog.DocString) error

func (*ServerTestFeature) SendWebsocketMessage

func (s *ServerTestFeature) SendWebsocketMessage(body *godog.DocString) error

func (*ServerTestFeature) SetWebsocketReadTimeout

func (s *ServerTestFeature) SetWebsocketReadTimeout(seconds string) error

func (*ServerTestFeature) ShouldNotContainForJsonQueryPath

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

func (*ServerTestFeature) SignedInAsA

func (s *ServerTestFeature) SignedInAsA(role string) error

func (*ServerTestFeature) TheMessageShouldContainA

func (s *ServerTestFeature) TheMessageShouldContainA(key string) error

func (*ServerTestFeature) TheMessageShouldNotContainA

func (s *ServerTestFeature) TheMessageShouldNotContainA(key string) error

func (*ServerTestFeature) TheResponseCodeShouldBe

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

func (*ServerTestFeature) TheResponseHeadersShouldContain

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

func (*ServerTestFeature) TheResponseShouldContain

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

func (*ServerTestFeature) TheResponseShouldContainA

func (s *ServerTestFeature) TheResponseShouldContainA(key string) error

func (*ServerTestFeature) TheResponseShouldContainAThatIsNotEmpty

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

func (*ServerTestFeature) TheResponseShouldContainAThatIsNotNull

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

func (*ServerTestFeature) TheResponseShouldContainAThatIsNull

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

func (*ServerTestFeature) TheResponseShouldContainATimeSetTo

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

func (*ServerTestFeature) TheResponseShouldContainSetTo

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

func (*ServerTestFeature) TheResponseShouldMatchJSON

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

func (*ServerTestFeature) TheResponseShouldNotContainA

func (s *ServerTestFeature) TheResponseShouldNotContainA(key string) error

func (*ServerTestFeature) UseSecretKey

func (s *ServerTestFeature) UseSecretKey() error

func (*ServerTestFeature) WaitForSeconds

func (s *ServerTestFeature) WaitForSeconds(seconds int)

func (*ServerTestFeature) WebsocketIsConnected

func (s *ServerTestFeature) WebsocketIsConnected() error

func (*ServerTestFeature) WebsocketIsNotConnected

func (s *ServerTestFeature) WebsocketIsNotConnected() error

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) string

type SuiteConfig

type SuiteConfig struct {
	Opts          *godog.Options
	ServiceClient abstract.AbstractClient
	Engine        *gin.Engine
	BeforeRequest func(body []byte)
	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