Back to godoc.org

Package report

v1.6.0
Latest Go to latest

The latest major version is .

Published: Sep 16, 2020 | License: MIT | Module: bitbucket.org/openbankingteam/conformance-suite

Overview

Enum to json.UnmarshalJson and json.MarshalJSON taken from: https://gist.github.com/lummie/7f5c237a17853c031a57277371528e87 We might be able to use https://github.com/campoy/jsonenums - might do this after the package is tested.

Enum to json.UnmarshalJson and json.MarshalJSON taken from: https://gist.github.com/lummie/7f5c237a17853c031a57277371528e87 We might be able to use https://github.com/campoy/jsonenums - might do this after the package is tested.

Index

Constants

const (
	// Version - version of the `Report`.
	// TODO(mbana): probably need a better way of getting/setting the version of the Report Exporter
	Version = "0.0.1"
)

Variables

var (
	// ErrExportFailure is the common error type returned on all export errors
	ErrExportFailure = errors.New("export failed")
)

func GetFails

func GetFails(specs map[results.ResultKey][]results.TestCase) int

GetFails - fails is the number of specification tests that failed, it is not the number of failed tests.

type APISpecification

type APISpecification struct {
	Name            string             `json:"name"`
	TLSVersion      string             `json:"tls_version"`
	TLSVersionValid bool               `json:"tls_version_valid"`
	Version         string             `json:"version"`
	Results         []results.TestCase `json:"results"`
}

type APIVersionList

type APIVersionList []*apiVersion

APIVersionList is a sortable collection of API name and version pairs

func (APIVersionList) Len

func (avl APIVersionList) Len() int

func (APIVersionList) Less

func (avl APIVersionList) Less(i, j int) bool

func (APIVersionList) Swap

func (avl APIVersionList) Swap(i, j int)

type CertifiedBy

type CertifiedBy struct {
	Environment  CertifiedByEnvironment `json:"environment"`  // Name of the environment tested
	Brand        string                 `json:"brand"`        // Name of the brand tested
	AuthorisedBy string                 `json:"authorisedBy"` // Name of the Authoriser
	JobTitle     string                 `json:"jobTitle"`     // Job Title of the Authorisee
}

CertifiedBy - contains details of who certified the `Report`.

func (CertifiedBy) Validate

func (r CertifiedBy) Validate() error

Validate - called by `github.com/go-ozzo/ozzo-validation` to validate struct.

type CertifiedByEnvironment

type CertifiedByEnvironment int

CertifiedByEnvironment - the environment the `Report` was generated in.

const (
	// ReportCertifiedByEnvironmentTesting - testing environment.
	CertifiedByEnvironmentTesting CertifiedByEnvironment = iota + 1
	// ReportCertifiedByEnvironmentProduction - production environment.
	CertifiedByEnvironmentProduction
	CertifiedByEnvironmentSandbox
)

func (CertifiedByEnvironment) MarshalJSON

func (r CertifiedByEnvironment) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (CertifiedByEnvironment) String

func (r CertifiedByEnvironment) String() string

func (*CertifiedByEnvironment) UnmarshalJSON

func (r *CertifiedByEnvironment) UnmarshalJSON(data []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type Exporter

type Exporter interface {
	Export() error
}

Exporter - allows the exporting of a `Report`.

func NewZipExporter

func NewZipExporter(report Report, writer io.Writer) Exporter

NewZipExporter - return new `Exporter` that exports to a ZIP archive to `writer`. The caller should close `writer` after calling `Export`.

For example:

writer, err := os.Create("report.zip")
defer writer.Close()
exporter := NewZipExporter(Report{}, writer)
exporter.Export()

type Importer

type Importer interface {
	Import() (Report, error)
}

Importer - allows the importing of a `Report`.

func NewZipImporter

func NewZipImporter(reader io.Reader) Importer

NewZipImporter - return new `Importer` that allows importing from a ZIP archive.

type Report

type Report struct {
	ID               string             `json:"id"`                       // A unique and immutable identifier used to identify the report. The v4 UUIDs generated conform to RFC 4122.
	Created          string             `json:"created"`                  // Date and time when the report was created, formatted accorrding to RFC3339 (https://tools.ietf.org/html/rfc3339). Note RFC3339 is derived from ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601).
	Expiration       *string            `json:"expiration,omitempty"`     // Date and time when the report should not longer be accepted, formatted accorrding to RFC3339 (https://tools.ietf.org/html/rfc3339). Note RFC3339 is derived from ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601).
	Fails            int                `json:"fails"`                    // Calculates *total* failures across the whole report, accumulated for each specification.
	Version          string             `json:"version"`                  // The current version of the report model used.
	Status           Status             `json:"status"`                   // A status describing overall condition of the report.
	CertifiedBy      CertifiedBy        `json:"certifiedBy"`              // The certifier of the report.
	APIVersions      APIVersionList     `json:"apiVersions"`              // List with the version & name of the tested APIs
	SignatureChain   *[]SignatureChain  `json:"signatureChain,omitempty"` // When Add digital signature is set this contains the signature chain.
	Discovery        discovery.Model    `json:"-"`                        // Original used discovery model
	ResponseFields   string             `json:"-"`                        // ResponseFields - already in JSON format
	APISpecification []APISpecification `json:"apiSpecification"`         // API and version tested, along with test cases
	FCSVersion       string             `json:"fcsVersion"`               // Version of FCS running the tests
	Products         []string           `json:"products"`                 // Products tested, e.g., "Business, Personal, Cards"
	JWSStatus        string             `json:"jwsStatus"`                // Signature status
	AgreedTC         bool               `json:"agreedTermsConditions"`    // Implementer acknowledged and agreed to T&C as displayed on the UI
}

Report - The Report.

func NewReport

func NewReport(exportResults models.ExportResults, environment string) (Report, error)

NewReport - create `Report` from `ExportResults`.

func (Report) Validate

func (r Report) Validate() error

Validate - called by `github.com/go-ozzo/ozzo-validation` to validate struct.

type SignatureChain

type SignatureChain struct {
	Type    string `json:"type"`
	Creator string `json:"creator"`
	Domain  string `json:"domain"`
	Nounce  string `json:"nounce"`
	Value   string `json:"value"`
}

SignatureChain -

type Status

type Status int

Status - the status of the `Report`.

const (
	// StatusPending - The `Report` is pending.
	StatusPending Status = iota + 1
	// StatusComplete - The `Report` is complete.
	StatusComplete
	// StatusError - The `Report` is in error.
	StatusError
)

func (Status) MarshalJSON

func (r Status) MarshalJSON() ([]byte, error)

MarshalJSON - marshals the enum as a quoted json string

func (Status) String

func (r Status) String() string

func (*Status) UnmarshalJSON

func (r *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON - unmashals a quoted json string to the enum value

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier