testhelpers

package
v0.0.0-...-b3f093e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package testhelpers is for test code that needs to be imported across packages DO NOT use this in production code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAction

func NewAction() models.Action

NewAction generates an action to use in tests

func NewBusinessCase

func NewBusinessCase(systemIntakeID uuid.UUID) models.BusinessCase

NewBusinessCase allows us to generate a business case for tests

func NewConfig

func NewConfig() *viper.Viper

NewConfig returns a global viper config for testing

func NewEstimatedLifecycleCost

func NewEstimatedLifecycleCost(opts EstimatedLifecycleCostOptions) models.EstimatedLifecycleCost

NewEstimatedLifecycleCost helps generate a new lifecycle cost for a given business case

func NewNote

func NewNote() models.SystemIntakeNote

NewNote generates a note to use in tests

func NewSystemIntake

func NewSystemIntake() models.SystemIntake

NewSystemIntake generates a system intake to use in tests

func NewValidLifecycleCosts

func NewValidLifecycleCosts(id *uuid.UUID) models.EstimatedLifecycleCosts

NewValidLifecycleCosts helps generate valid lifecycle costs for a given business case ready for submission

func OktaAccessToken

func OktaAccessToken(config *viper.Viper) (string, error)

OktaAccessToken is a thread safe config retrieval for an access token It only fetches a new token if it hasn't been set already

func RandomEUAID

func RandomEUAID() string

RandomEUAID returns a random EUA ID for testing

func RandomEUAIDNull

func RandomEUAIDNull() null.String

RandomEUAIDNull returns a random EUA ID for testing, in the form of a null.String

Types

type AuthnResponse

type AuthnResponse struct {
	StateToken   string   `json:"stateToken"`
	Status       string   `json:"status"`
	Embedded     Embedded `json:"_embedded"`
	SessionToken string   `json:"sessionToken"`
}

AuthnResponse is a response marshaled from Okta authn API

type Embedded

type Embedded struct {
	Factors []Factor `json:"factors"`
}

Embedded is part of the Okta authn response

type EstimatedLifecycleCostOptions

type EstimatedLifecycleCostOptions struct {
	BusinessCaseID *uuid.UUID
	Solution       *models.LifecycleCostSolution
	Phase          *models.LifecycleCostPhase
	Year           *models.LifecycleCostYear
	Cost           *int
}

EstimatedLifecycleCostOptions allows cost options to be customized

type Factor

type Factor struct {
	ID       string     `json:"id"`
	Provider string     `json:"provider"`
	Link     FactorLink `json:"_links"`
}

Factor has a challenge factor for MFA

type FactorLink struct {
	Verify FactorLinkVerify `json:"verify"`
}

FactorLink is a wrapper for a challenge link

type FactorLinkVerify

type FactorLinkVerify struct {
	HREF string `json:"href"`
}

FactorLinkVerify is the challenge verification link

type SettableClock

type SettableClock struct {
	*clock.Mock
}

SettableClock is a mock clock that can be set

func (*SettableClock) Set

func (c *SettableClock) Set(now time.Time)

Set sets the clock's Now() to the given time

Jump to

Keyboard shortcuts

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