tests

package
v1.4.39 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: Apache-2.0 Imports: 18 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 CreateTestDatabase

func CreateTestDatabase(s string) (*identity.Database, error)

CreateTestDatabase returns database instance.

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 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 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