testutil

package
v0.0.0-...-fbda54b Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Authorization name
	Authorization = "Authorization"
	// BearPrefix name
	BearPrefix = "Bearer "
	// DomainName name
	DomainName = "test.com"
	// ID name
	ID = "id"
	// Input name
	Input = "input"
)

Variables

View Source
var InitUser generated.Login

InitUser login with Init User then reuse its token to test other testcases

Functions

func BuildCreatePermissionGroupIn

func BuildCreatePermissionGroupIn() *model.CreatePermissionGroupIn

BuildCreatePermissionGroupIn to be reused

func RamdomDateStringInPass

func RamdomDateStringInPass() *string

RamdomDateStringInPass create a random date in the pass to fake birthday...

func RandomEmail

func RandomEmail() *string

RandomEmail create a random email

func RandomString

func RandomString(n int) *string

RandomString create a random string with desired length

func RandomURL

func RandomURL() *string

RandomURL create a random URL

Types

type Suite

type Suite struct {
	suite.Suite
	*client.Client
	// contains filtered or unexported fields
}

Suite utils

func (*Suite) AddHeaderAuthAdmin

func (s *Suite) AddHeaderAuthAdmin() client.Option

AddHeaderAuthAdmin add admin authorization header

func (*Suite) CreatePermissionGroup

func (s *Suite) CreatePermissionGroup(input *model.CreatePermissionGroupIn) (generated.CreatePermissionGroup, error)

CreatePermissionGroup create permission group

func (*Suite) Login

func (s *Suite) Login(email, password string) (generated.Login, error)

Login login

func (*Suite) LoginWithInitUser

func (s *Suite) LoginWithInitUser() generated.Login

LoginWithInitUser use Init User (is configured in the internal/config/config.yaml) that has full permissions to login then keep the response in the global variable to help other testcases, for example use the token to authorize the POST request in other testcases

func (*Suite) Setup

func (s *Suite) Setup()

Setup prepare before running tests

Jump to

Keyboard shortcuts

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