common

package
v0.32.35 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TestOutputTable string = "table"
	TestOutputCSV   string = "csv"
	Expected        string = "expected"
	Description     string = "description"
	DescOff         string = "off"
	DescOn          string = "on"
	DescOnError     string = "on-error"
	Passed          string = "PASS"
	Failed          string = "FAIL"
	Errored         string = "ERR "
)
View Source
const (
	CheckStr           string = "check"
	CheckRelationStr   string = "check_relation"
	CheckPermissionStr string = "check_permission"
	CheckDecisionStr   string = "check_decision"
)
View Source
const (
	CLIConfigurationFile = "topaz.json"
)

Variables

View Source
var (
	ErrSkippedAuthorizerAssertion = cerr.NewAsertoError("T10001", codes.Internal, http.StatusInternalServerError, "no authorizer client")
	ErrSkippedDirectoryAssertion  = cerr.NewAsertoError("T10002", codes.Internal, http.StatusInternalServerError, "no directory client")
)

Functions

func GetBool added in v0.32.27

func GetBool(msg *structpb.Struct, fieldName string) (bool, bool)

func GetString added in v0.32.27

func GetString(msg *structpb.Struct, fieldName string) (string, bool)

func PrintDesc added in v0.32.27

func PrintDesc(descFlag, description string, result *CheckResult, expected bool)

func PromptYesNo

func PromptYesNo(label string, def bool) bool

func UnmarshalReq added in v0.32.27

func UnmarshalReq(value *structpb.Value, msg proto.Message) error

Types

type CheckResult added in v0.32.27

type CheckResult struct {
	Outcome  bool
	Duration time.Duration
	Err      error
	Str      string
}

func (*CheckResult) PrintCSV added in v0.32.27

func (cr *CheckResult) PrintCSV(w *csv.Writer, index int, expected bool, checkType CheckType, description string)

func (*CheckResult) PrintCSVHeader added in v0.32.27

func (cr *CheckResult) PrintCSVHeader(w *csv.Writer)

func (*CheckResult) PrintTable added in v0.32.27

func (cr *CheckResult) PrintTable(w io.Writer, index int, expected bool, checkType CheckType, noColor bool)

type CheckType added in v0.32.27

type CheckType int
const (
	CheckUnknown CheckType = iota
	Check
	CheckRelation
	CheckPermission
	CheckDecision
)

func GetCheckType added in v0.32.27

func GetCheckType(msg *structpb.Struct) CheckType

type SaveContext

type SaveContext bool
var (
	Save                  SaveContext
	RestrictedNamePattern = regexp.MustCompile(`^[a-z0-9][a-z0-9_.-]*$`)
)

type TestExecCmd added in v0.32.27

type TestExecCmd struct {
	Files   []string `arg:""  default:"assertions.json" help:"path to assertions file" sep:"none" optional:""`
	Stdin   bool     `flag:"" default:"false" help:"read assertions from --stdin"`
	Summary bool     `flag:"" default:"false" help:"display test summary"`
	Format  string   `flag:"" default:"table" help:"output format (table|csv)" enum:"table,csv"`
	Desc    string   `flag:"" default:"off" enum:"off,on,on-error" help:"output descriptions (off|on|on-error)"`
}

type TestResults added in v0.32.27

type TestResults struct {
	// contains filtered or unexported fields
}

func NewTestResults added in v0.32.27

func NewTestResults(assertions []json.RawMessage) *TestResults

func (*TestResults) Errored added in v0.32.27

func (t *TestResults) Errored() int32

func (*TestResults) Failed added in v0.32.27

func (t *TestResults) Failed() int32

func (*TestResults) IncrErrored added in v0.32.27

func (t *TestResults) IncrErrored()

func (*TestResults) IncrFailed added in v0.32.27

func (t *TestResults) IncrFailed()

func (*TestResults) IncrPassed added in v0.32.27

func (t *TestResults) IncrPassed()

func (*TestResults) IncrSkipped added in v0.32.27

func (t *TestResults) IncrSkipped()

func (*TestResults) IncrTotal added in v0.32.27

func (t *TestResults) IncrTotal()

func (*TestResults) Passed added in v0.32.27

func (t *TestResults) Passed(passed bool)

func (*TestResults) PrintSummary added in v0.32.27

func (t *TestResults) PrintSummary(w io.Writer)

type TestRunner added in v0.32.27

type TestRunner struct {
	// contains filtered or unexported fields
}

func NewAuthorizerTestRunner added in v0.32.27

func NewAuthorizerTestRunner(c *cc.CommonCtx, cmd *TestExecCmd, azConfig *azc.Config) (*TestRunner, error)

func NewDirectoryTestRunner added in v0.32.27

func NewDirectoryTestRunner(c *cc.CommonCtx, cmd *TestExecCmd, dsConfig *dsc.Config) (*TestRunner, error)

func NewTestRunner added in v0.32.27

func NewTestRunner(c *cc.CommonCtx, cmd *TestExecCmd, azConfig *azc.Config, dsConfig *dsc.Config) (*TestRunner, error)

func (*TestRunner) Run added in v0.32.27

func (runner *TestRunner) Run(c *cc.CommonCtx) error

Jump to

Keyboard shortcuts

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