testrunner

package
v0.0.0-...-f9cf50c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestCaseSchema = validation.NewMultipartSchema("TestCase")

Functions

func DumpSchema

func DumpSchema() (string, error)

func MatchOutput

func MatchOutput(output Output, flowResult *authflowclient.FlowResponse, flowError error) (resultViolations []MatchViolation, errorViolations []MatchViolation, err error)

Types

type AuthgearYAMLSource

type AuthgearYAMLSource struct {
	Extend   string `json:"extend"`
	Override string `json:"override"`
}

type BeforeHook

type BeforeHook struct {
	Type       BeforeHookType      `json:"type"`
	UserImport string              `json:"user_import"`
	CustomSQL  BeforeHookCustomSQL `json:"custom_sql"`
}

type BeforeHookCustomSQL

type BeforeHookCustomSQL struct {
	Path string `json:"path"`
}

type BeforeHookType

type BeforeHookType string
const (
	BeforeHookTypeUserImport BeforeHookType = "user_import"
	BeforeHookTypeCustomSQL  BeforeHookType = "custom_sql"
)

type End2EndCmd

type End2EndCmd struct {
	AppID    string
	TestCase TestCase
}

func (*End2EndCmd) CreateConfigSource

func (e *End2EndCmd) CreateConfigSource() error

func (*End2EndCmd) ExecuteCustomSQL

func (e *End2EndCmd) ExecuteCustomSQL(sqlPath string) error

func (*End2EndCmd) GetLinkOTPCodeByClaim

func (e *End2EndCmd) GetLinkOTPCodeByClaim(claim string, value string) (string, error)

func (*End2EndCmd) ImportUsers

func (e *End2EndCmd) ImportUsers(jsonPath string) error

type MatchViolation

type MatchViolation struct {
	Path     string `json:"path"`
	Message  string `json:"message"`
	Expected string `json:"expected"`
	Actual   string `json:"actual"`
}

func MatchJSON

func MatchJSON(jsonStr string, schema string) ([]MatchViolation, error)

*

 MatchJSON compares a json string to a schema json string, for example
 {
		"id": "[[number]]",
		"title": "[[string]]",
		"publish": "[[boolean]]",
		"type": "articles",
		"tags": ["[[arrayof]]", "[[object]]"],
		"error": "[[null]]",
		"ignoreme": "[[ignore]]",
 }
 *

type Output

type Output struct {
	Result string `json:"result"`
	Error  string `json:"error"`
}

type Step

type Step struct {
	Name   string     `json:"name"`
	Action StepAction `json:"action"`

	// `action` == "create" or "input"
	Input string `json:"input"`

	// `action` == "oauth_redirect"
	To          string `json:"to"`
	RedirectURI string `json:"redirect_uri"`

	Output *Output `json:"output"`
}

type StepAction

type StepAction string
const (
	StepActionCreate        StepAction = "create"
	StepActionInput         StepAction = "input"
	StepActionOAuthRedirect StepAction = "oauth_redirect"
)

type StepResult

type StepResult struct {
	Result interface{} `json:"result"`
	Error  error       `json:"error"`
}

type TestCase

type TestCase struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// Applying focus to a test case will make it the only test case to run,
	// mainly used for debugging new test cases.
	Focus              bool               `json:"focus"`
	AuthgearYAMLSource AuthgearYAMLSource `json:"authgear.yaml"`
	Steps              []Step             `json:"steps"`
	Before             []BeforeHook       `json:"before"`
}

func (*TestCase) FullName

func (tc *TestCase) FullName() string

func (*TestCase) Run

func (tc *TestCase) Run(t *testing.T)

type TestRunner

type TestRunner struct {
	T    *testing.T
	Path string
}

func NewTestRunner

func NewTestRunner(t *testing.T, path string) *TestRunner

func (*TestRunner) Run

func (tr *TestRunner) Run()

Jump to

Keyboard shortcuts

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