manifest

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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 GenerateTestCaseListCSV added in v1.6.0

func GenerateTestCaseListCSV()

func GetConsentIDFromMatches added in v1.1.0

func GetConsentIDFromMatches(tc model.TestCase) string

GetConsentIDFromMatches -

func GetSpecType added in v1.1.0

func GetSpecType(spec string) (string, error)

GetSpecType - examines the

func LoadGenerationResources added in v1.1.7

func LoadGenerationResources(specType, manifestPath string, ctx *model.Context) (Scripts, References, error)

func MapTokensToCBPIITestCases added in v1.2.0

func MapTokensToCBPIITestCases(rt []RequiredTokens, tcs []model.TestCase, ctx *model.Context)

MapTokensToCBPIITestCases maps tokens retrieved after the consent acquisition flow maps them into test cases that require access tokens (ccg tokens)

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

func (*ConsentJobs) Get added in v1.1.0

func (cj *ConsentJobs) Get(testid string) (model.TestCase, bool)

Get a consentJob

type DiscoveryPathsTestIDs

type DiscoveryPathsTestIDs map[string][]string

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 GenerationParameters added in v1.2.0

type GenerationParameters struct {
	Scripts      Scripts
	Spec         discovery.ModelAPISpecification
	Baseurl      string
	Ctx          *model.Context
	Endpoints    []discovery.ModelEndpoint
	ManifestPath string
	Validator    schema.Validator
	Conditional  []discovery.ConditionalAPIProperties
}

type PathRegex added in v1.1.16

type PathRegex struct {
	Regex  string
	Method string
	Name   string
}

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

type References struct {
	References map[string]Reference `json:"references,omitempty"`
}

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
	AccountID       string
}

RequiredTokens -

func GetCbpiiPermissions added in v1.2.0

func GetCbpiiPermissions(tests []model.TestCase) ([]RequiredTokens, error)

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 {
	APIName               string            `json:"apiName"`
	APIVersion            string            `json:"apiVersion"`
	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"`
	QueryParameters       map[string]string `json:"queryParameters"`
	Headers               map[string]string `json:"headers,omitempty"`
	RemoveHeaders         []string          `json:"removeHeaders,omitempty"`
	RemoveSignatureClaims []string          `json:"removeSignatureClaims,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"`
	AssertsOneOf          []string          `json:"asserts_one_of,omitempty"`
	Method                string            `json:"method,omitempty"`
	URI                   string            `json:"uri,omitempty"`
	URIImplemenation      string            `json:"uriImplementation,omitempty"`
	SchemaCheck           bool              `json:"schemaCheck,omitempty"`
	ContextPut            map[string]string `json:"keepContextOnSuccess,omitempty"`
	UseCCGToken           bool              `json:"useCCGToken,omitempty"`
	ValidateSignature     bool              `json:"validateSignature,omitempty"`
}

Script represents a highlevel test definition

type ScriptPermission

type ScriptPermission struct {
	ID          string
	Permissions []string
	Path        string
}

ScriptPermission -

type Scripts

type Scripts struct {
	Scripts []Script `json:"scripts,omitempty"`
}

Scripts -

func FilterTestsBasedOnDiscoveryEndpoints added in v1.1.7

func FilterTestsBasedOnDiscoveryEndpoints(scripts Scripts, endpoints []discovery.ModelEndpoint, regPaths []PathRegex) (Scripts, error)

FilterTestsBasedOnDiscoveryEndpoints returns a subset of the first `scripts` parameter, thus filtering `scripts`. Filtering is performed by matching (via `regPaths` regex's) the provided `endpoints` against the provided `scripts`. The result is: For each path in the collection of scripts returned, there is at least one matching path in the `endpoint` list.

func GenerateTestCases

func GenerateTestCases(params *GenerationParameters) ([]model.TestCase, Scripts, error)

GenerateTestCases examines a manifest file, asserts file and resources definition, then builds the associated test cases

func LoadScripts

func LoadScripts(filename string) (Scripts, error)

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 -

Jump to

Keyboard shortcuts

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