tests

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TestUser1 is the username for user1.
	TestUser1 = "jsmith"
	// TestEmail1 is the email for user1.
	TestEmail1 = "jsmith@gmail.com"
	// TestPwd1 is the password for user1.
	TestPwd1 = NewRandomString(12)
	// TestFullName1 is the full name for user1.
	TestFullName1 = "Smith, John"
	// TestRoles1 is the roles for user1.
	TestRoles1 = []string{"viewer", "editor", "admin", "authp/admin"}
	// TestUser2 is the username for user2.
	TestUser2 = "bjones"
	// TestEmail2 is the email for user2.
	TestEmail2 = "bjones@gmail.com"
	// TestPwd2 is the password for user2.
	TestPwd2 = NewRandomString(16)
	// TestFullName2  is the full name for user2.
	TestFullName2 = ""
	// TestRoles2 is the roles for user2.
	TestRoles2 = []string{"viewer"}
)

Functions

func CustomEvalObjectsWithLog

func CustomEvalObjectsWithLog(t *testing.T, name string, want, got interface{}, msgs []string, typs interface{})

CustomEvalObjectsWithLog compares two objects and logs extra output when detects an error.

func EvalErr

func EvalErr(t *testing.T, err error, data interface{}, shouldErr bool, expErr error) bool

EvalErr evaluates whether there is an error. If there is, was it the expected error.

func EvalErrPhaseWithLog

func EvalErrPhaseWithLog(t *testing.T, err error, errPhase, expErrPhase string, shouldErr bool, expErr error, msgs []string) bool

EvalErrPhaseWithLog evaluates the error according to the phase of execution.

func EvalErrWithLog

func EvalErrWithLog(t *testing.T, err error, data interface{}, shouldErr bool, expErr error, msgs []string) bool

EvalErrWithLog evaluates the error.

func EvalObjects

func EvalObjects(t *testing.T, name string, want, got interface{})

EvalObjects compares two objects.

func EvalObjectsWithLog

func EvalObjectsWithLog(t *testing.T, name string, want, got interface{}, msgs []string)

EvalObjectsWithLog compares two objects and logs extra output when detects an error.

func GetCryptoKeyPair

func GetCryptoKeyPair(t *testing.T, keyAlgo, publicKeyType string) (string, string)

GetCryptoKeyPair returns private-public key pair.

func NewID

func NewID() string

NewID returns a random ID to be used for user identification.

func NewRandomString

func NewRandomString(length int) string

NewRandomString returns a random string.

func TempDir

func TempDir(s string) (string, error)

TempDir creates temporary directory.

func Unpack

func Unpack(t *testing.T, i interface{}) (m map[string]interface{})

Unpack converts input to map.

func UnpackJSON

func UnpackJSON(t *testing.T, m map[string]interface{}) string

UnpackJSON converts a map to a JSON string.

func WriteLog

func WriteLog(t *testing.T, msgs []string)

WriteLog writes logs from tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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