test

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: AGPL-3.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqualJSON added in v0.23.0

func AssertEqualJSON(t *testing.T, expected json.RawMessage, actual json.RawMessage, msg string, msgArgs ...interface{}) bool

AssertEqualJSON checks two JSON strings for equality

func AssertXEqual added in v0.33.8

func AssertXEqual(t *testing.T, expected types.XValue, actual types.XValue, msgAndArgs ...interface{}) bool

AssertEqual is equivalent to assert.Equal for two XValue instances

func CreateSessionAssets added in v0.38.0

func CreateSessionAssets(assetsJSON json.RawMessage, testServerURL string) (flows.SessionAssets, error)

CreateSessionAssets creates assets from given JSON

func CreateTestSession

func CreateTestSession(testServerURL string, actionToAdd flows.Action, redact envs.RedactionPolicy) (flows.Session, []flows.Event, error)

CreateTestSession creates a standard example session for testing

func CreateTestVoiceSession added in v0.24.0

func CreateTestVoiceSession(testServerURL string, actionToAdd flows.Action) (flows.Session, []flows.Event, error)

CreateTestVoiceSession creates a standard example session for testing voice flows and actions

func JSONDelete added in v0.50.0

func JSONDelete(data json.RawMessage, path []string) json.RawMessage

JSONDelete deletes a node in JSON

func JSONReplace added in v0.39.0

func JSONReplace(data json.RawMessage, path []string, value json.RawMessage) json.RawMessage

JSONReplace replaces a node in JSON

func LoadFlowFromAssets added in v0.29.0

func LoadFlowFromAssets(path string, uuid assets.FlowUUID) (flows.Flow, error)

func LoadSessionAssets added in v0.25.0

func LoadSessionAssets(path string) (flows.SessionAssets, error)

LoadSessionAssets loads a session assets instance from a static JSON file

func NewChannel added in v0.15.0

func NewChannel(name string, address string, schemes []string, roles []assets.ChannelRole, parent *assets.ChannelReference) *flows.Channel

func NewClassifier added in v0.51.0

func NewClassifier(name, type_ string, intents []string) *flows.Classifier

func NewEngine added in v0.48.0

func NewEngine() flows.Engine

NewEngine creates an engine instance for testing

func NewField added in v0.15.0

func NewField(key string, name string, valueType assets.FieldType) *flows.Field

func NewGroup added in v0.15.0

func NewGroup(name string, query string) *flows.Group

func NewTelChannel added in v0.15.0

func NewTelChannel(name string, address string, roles []assets.ChannelRole, parent *assets.ChannelReference, country string, matchPrefixes []string) *flows.Channel

func NewTestHTTPServer

func NewTestHTTPServer(port int) *httptest.Server

NewTestHTTPServer sets up a mock server for webhook actions

func NormalizeJSON added in v0.23.0

func NormalizeJSON(data json.RawMessage) ([]byte, error)

NormalizeJSON re-formats the given JSON

Types

type EventLog added in v0.51.0

type EventLog struct {
	Events []flows.Event
}

EventLog is a utility for testing things which take an event logger function

func NewEventLog added in v0.51.0

func NewEventLog() *EventLog

NewEventLog creates a new event log

func (*EventLog) Log added in v0.51.0

func (l *EventLog) Log(e flows.Event)

Jump to

Keyboard shortcuts

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