Documentation
¶
Overview ¶
Package sessiontest implements test helpers for functionalities defined in session.
Index ¶
- func NewConfig(rng *rand.Rand, contacts ...perun.Peer) (session.Config, error)
- func NewConfigFile(config interface{}) (string, error)
- func NewConfigFileT(t *testing.T, config session.Config) string
- func NewConfigT(t *testing.T, rng *rand.Rand, contacts ...perun.Peer) session.Config
- func NewUserConfig(rng *rand.Rand, n uint) (perun.WalletBackend, session.UserConfig, error)
- func NewUserConfigT(t *testing.T, rng *rand.Rand, n uint) (perun.WalletBackend, session.UserConfig)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConfig ¶
NewConfig generates random configuration data for the session using the given prng and contacts. A contacts file is created with the given set of peers and path to it is added in the config. This function also registers cleanup functions for removing all the temp files and dirs after the test.
This function returns a session config with user on-chain addresses that are funded on blockchain when using a particular seed for prng. The first two consecutive calls to this function will return funded accounts when using prng := rand.New(rand.NewSource(1729)).
func NewConfigFile ¶
NewConfigFile creates a temporary file containing the given session configuration and returns the path to it. It also registers a cleanup function on the passed test handler.
func NewConfigFileT ¶ added in v0.4.0
NewConfigFileT is the test friendly version of NewConfigFile. It uses the passed testing.T to handle the errors and registers the cleanup functions on it.
func NewConfigT ¶ added in v0.4.0
NewConfigT is the test friendly version of NewConfig. It uses the passed testing.T to handle the errors and registers the cleanup functions on it.
func NewUserConfig ¶
func NewUserConfig(rng *rand.Rand, n uint) (perun.WalletBackend, session.UserConfig, error)
NewUserConfig returns a test user configuration with random data generated using the given rng. It creates "n" participant accounts to the user.
func NewUserConfigT ¶ added in v0.4.0
func NewUserConfigT(t *testing.T, rng *rand.Rand, n uint) (perun.WalletBackend, session.UserConfig)
NewUserConfigT is the test friendly version of NewUserConfig. It uses the passed testing.T to handle the errors and registers the cleanup functions on it.
Types ¶
This section is empty.