Documentation ¶
Index ¶
- func FindUnmatchedManifestTests(mf Scripts, mappedTests DiscoveryPathsTestIDs) []string
- func GenerateTestCases(spec string, baseurl string, ctx *model.Context, ...) ([]model.TestCase, error)
- func GetConsentIDFromMatches(tc model.TestCase) string
- func GetSpecType(s string) (string, error)
- func MapTokensToPaymentTestCases(rt []RequiredTokens, tcs []model.TestCase, ctx *model.Context)
- func MapTokensToTestCases(rt []RequiredTokens, tcs []model.TestCase) map[string]string
- type ConsentJobs
- type DiscoveryPathsTestIDs
- type Reference
- type References
- type RequiredTokens
- type Script
- type ScriptPermission
- type Scripts
- type TestCasePermission
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindUnmatchedManifestTests ¶
func FindUnmatchedManifestTests(mf Scripts, mappedTests DiscoveryPathsTestIDs) []string
FindUnmatchedManifestTests Find all the TestIDs from Manifest that have not been matched against an endpoint in the discovery model
func GenerateTestCases ¶
func GenerateTestCases(spec string, baseurl string, ctx *model.Context, endpoints []discovery.ModelEndpoint) ([]model.TestCase, error)
GenerateTestCases examines a manifest file, asserts file and resources definition, then builds the associated test cases
func GetConsentIDFromMatches ¶ added in v1.1.0
GetConsentIDFromMatches -
func GetSpecType ¶ added in v1.1.0
GetSpecType - TODO - check that this mapping is reasonable
func MapTokensToPaymentTestCases ¶ added in v1.1.0
func MapTokensToPaymentTestCases(rt []RequiredTokens, tcs []model.TestCase, ctx *model.Context)
MapTokensToPaymentTestCases -
func MapTokensToTestCases ¶
func MapTokensToTestCases(rt []RequiredTokens, tcs []model.TestCase) map[string]string
MapTokensToTestCases - applies consented tokens to testcases
Types ¶
type ConsentJobs ¶ added in v1.1.0
type ConsentJobs struct {
// contains filtered or unexported fields
}
ConsentJobs Holds jobs required only to provide consent so should not show on the ui
func GetConsentJobs ¶ added in v1.1.0
func GetConsentJobs() *ConsentJobs
GetConsentJobs - makes a structure to hold a list of payment consent jobs than need to be run before the main tests and so aren't included in the main test list
func (*ConsentJobs) Add ¶ added in v1.1.0
func (cj *ConsentJobs) Add(tc model.TestCase)
Add a consent Job
type DiscoveryPathsTestIDs ¶
DiscoveryPathsTestIDs -
func MapDiscoveryEndpointsToManifestTestIDs ¶
func MapDiscoveryEndpointsToManifestTestIDs(disco *discovery.Model, mf Scripts) DiscoveryPathsTestIDs
MapDiscoveryEndpointsToManifestTestIDs creates a mapping such that: - For each [endpoint + method] in the discovery file - Find all of the tests that exist in the manifest file, which contain the same [endpoint + method] combination - For each match, store that match in a map, which uses the endpoint as the map pair key and the map pair value is a list of each of the tests in the manifest relating to specified endpoint. - The value from the previous should be further broken down into another map, containing a list of each test id, where the keys in the second map are the http methods. Example output: 3 tests for "GET" method on the "/accounts" endpoint and 1 test for "HEAD" method.
"/accounts": { "GET": [ "OB-301-ACC-811741", "OB-301-ACC-431102", "OB-301-ACC-880736" ], "HEAD": [ "HEAD-OB-301-ACC-431102" ] }
type Reference ¶
type Reference struct { Expect model.Expect `json:"expect,omitempty"` Permissions []string `json:"permissions,omitempty"` Body interface{} `json:"body,omitempty"` BodyData string `json:"bodyData"` }
Reference is an item referred to by the test script list an assert of token reqirement
type References ¶
References - reference collection
type RequiredTokens ¶
type RequiredTokens struct { Name string `json:"name,omitempty"` Token string `json:"token,omitempty"` IDs []string `json:"ids,omitempty"` Perms []string `json:"perms,omitempty"` Permsx []string `json:"permsx,omitempty"` AccessToken string ConsentURL string ConsentID string ConsentParam string ConsentProvider string }
RequiredTokens -
func GetPaymentPermissions ¶ added in v1.1.0
func GetPaymentPermissions(tests []model.TestCase) ([]RequiredTokens, error)
GetPaymentPermissions - and annotate test cases with token ids
func GetRequiredTokensFromTests ¶
func GetRequiredTokensFromTests(tcs []model.TestCase, spec string) (rt []RequiredTokens, err error)
GetRequiredTokensFromTests - Given a set of testcases with the permissions defined in the context using 'permissions' and 'permissions-excluded' provides a RequiredTokens structure which can be used to capture token requirements
type Script ¶
type Script struct { Description string `json:"description,omitempty"` Detail string `json:"detail,omitempty"` ID string `json:"id,omitempty"` RefURI string `json:"refURI,omitempty"` Parameters map[string]string `json:"parameters,omitempty"` Headers map[string]string `json:"headers,omitempty"` Body string `json:"body,omitempty"` Permissions []string `json:"permissions,omitemtpy"` PermissionsExcluded []string `json:"permissions-excluded,omitemtpy"` Resource string `json:"resource,omitempty"` Asserts []string `json:"asserts,omitempty"` Method string `json:"method,omitempty"` URI string `json:"uri,omitempty"` URIImplemenation string `json:"uri_implemenation,omitempty"` SchemaCheck bool `json:"schemaCheck,omitempty"` ContextPut map[string]string `json:"keepContextOnSuccess,omitempty"` }
Script represents a highlevel test definition
type ScriptPermission ¶
ScriptPermission -
type Scripts ¶
type Scripts struct {
Scripts []Script `json:"scripts,omitempty"`
}
Scripts -
func LoadScripts ¶
LoadScripts loads the scripts from JSON encoded contents of filename and returns Scripts objects
type TestCasePermission ¶
type TestCasePermission struct { ID string `json:"id,omitempty"` Perms []string `json:"perms,omitempty"` Permsx []string `json:"permsx,omitempty"` }
TestCasePermission -
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore eats tokens
func (*TokenStore) GetNextTokenName ¶
func (te *TokenStore) GetNextTokenName(s string) string
GetNextTokenName -