factories

package
v0.0.0-...-cd5470e Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostRulesFactory = factory.NewFactory(models.HostRules{}).
	Attr(
		"Host",
		func(args factory.Args) (interface{}, error) {
			return fake.DomainName(), nil
		},
	).
	SubFactory("DefaultTarget", TargetFactory).
	SubSliceFactory(
		"Rules",
		RuleFactory,
		func() int {
			return rand.Intn(5)
		},
	)

HostRulesFactory generate HostRule

View Source
var RuleFactory = factory.NewFactory(models.Rule{}).
	SubFactory("Target", TargetFactory).
	Attr("Resolver", func(args factory.Args) (interface{}, error) { return "simple", nil }).
	Attr("SourcePath", pathFactory)

RuleFactory generate models.Rule

View Source
var TargetFactory = factory.NewFactory(models.Target{}).
	Attr(
		"HTTPCode",
		func(args factory.Args) (interface{}, error) {
			return 300 + rand.Int31n(100), nil
		},
	).
	Attr("Path", pathFactory)

TargetFactory generate models.Target

Functions

func GeneratePath

func GeneratePath() string

GeneratePath generate random path

Types

This section is empty.

Jump to

Keyboard shortcuts

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