test

package
v0.0.0-...-3da28a4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const UNDEFINED_CATEGORY_ID uint32 = 1000000000
View Source
const UNDEFINED_LOCATION_ID uint32 = 1000000000

Variables

This section is empty.

Functions

func CheckHTTPErrorMessage

func CheckHTTPErrorMessage(t *testing.T, err error, message string)

func Init

func Init()

func LoginTestGet

func LoginTestGet(t *testing.T, o func(h *handler.Handler, e echo.Context) error)

func MakeRandomStr

func MakeRandomStr(digit uint32) (string, error)

Types

type TestBio

type TestBio struct {
	UserId     uint32
	IsPublic   bool
	LocationId uint32
	Position   string
	PositionJa string
	Join       time.Time
	Leave      time.Time

	LocationType      location.Type
	LocationName      string
	LocationNameJa    string
	LocationAddress   string
	LocationAddressJa string

	Biography *ent.Biography
	Location  *ent.Location
}

func NewTestBio

func NewTestBio(userId uint32) (*TestBio, error)

func (*TestBio) CreateDB

func (c *TestBio) CreateDB(ctx context.Context, db *db.DB) (*ent.Biography, error)

func (*TestBio) CreateLocationDB

func (c *TestBio) CreateLocationDB(ctx context.Context, db *db.DB) (*ent.Location, error)
type TestLink struct {
	UserId     uint32
	Name       string
	NameJa     string
	SiteURL    string
	FaviconURL string

	CategoryId uint32

	CategoryName   string
	CategoryNameJa string
	Emoji          string

	Link     *ent.Link
	Category *ent.Category
}
func NewTestLink(userId uint32) (*TestLink, error)

func (*TestLink) CreateCategoryDB

func (c *TestLink) CreateCategoryDB(ctx context.Context, db *db.DB) (*ent.Category, error)

func (*TestLink) CreateDB

func (c *TestLink) CreateDB(ctx context.Context, db *db.DB) (*ent.Link, error)

type TestNotice

type TestNotice struct {
	UserId         uint32
	DiscordWebhook string
	SlackWebhook   string
	Mail           string

	Notice *ent.Notice
}

func NewTestNotice

func NewTestNotice(userId uint32) (*TestNotice, error)

func (*TestNotice) CreateDB

func (c *TestNotice) CreateDB(ctx context.Context, db *db.DB) (*ent.Notice, error)

type TestProduct

type TestProduct struct {
	UserId    uint32
	Name      string
	NameJa    string
	Detail    string
	DetailJa  string
	SiteURL   string
	GithubURL string
	DevTime   time.Time
	Thumbnail string

	Product *ent.Product
}

func NewTestProduct

func NewTestProduct(userId uint32) (*TestProduct, error)

func (*TestProduct) CreateDB

func (c *TestProduct) CreateDB(ctx context.Context, db *db.DB) (*ent.Product, error)

type TestTool

type TestTool struct {
	DB *db.DB

	Users []*TestUser
}

func NewTestTool

func NewTestTool() (*TestTool, error)

Create test tool

defer tool.Close()

func (*TestTool) ClearBio

func (c *TestTool) ClearBio(ctx context.Context) error
func (c *TestTool) ClearLink(ctx context.Context) error

func (*TestTool) ClearLocation

func (c *TestTool) ClearLocation(ctx context.Context) error

func (*TestTool) ClearNotice

func (c *TestTool) ClearNotice(ctx context.Context) error

func (*TestTool) ClearProduct

func (c *TestTool) ClearProduct(ctx context.Context) error

func (*TestTool) ClearUser

func (c *TestTool) ClearUser(ctx context.Context) error

func (*TestTool) Close

func (c *TestTool) Close()

func (*TestTool) GetUserIds

func (c *TestTool) GetUserIds() []uint32

Returns list of user ids

func (*TestTool) Handler

func (c *TestTool) Handler() (*handler.Handler, error)

func (*TestTool) NewForm

func (c *TestTool) NewForm() (*sender.SendForm, error)

func (*TestTool) NewUser

func (c *TestTool) NewUser(ctx context.Context) (*TestUser, error)

type TestUser

type TestUser struct {
	GivenName    string
	FamilyName   string
	UserId       string
	Mail         string
	BirthDate    time.Time
	GivenNameJa  string
	FamilyNameJa string
	Location     string
	LocationJa   string
	AvatarURL    string
	SSOToken     string

	User    *ent.User
	Session *ent.Session
}

func NewUser

func NewUser(d ...ent.User) (*TestUser, error)

func (*TestUser) CreateBio

func (c *TestUser) CreateBio() (*TestBio, error)

func (*TestUser) CreateDB

func (c *TestUser) CreateDB(ctx context.Context, db *db.DB) error

Insert from User Databases

func (c *TestUser) CreateLink() (*TestLink, error)

func (*TestUser) CreateNotice

func (c *TestUser) CreateNotice() (*TestNotice, error)

func (*TestUser) CreateProduct

func (c *TestUser) CreateProduct() (*TestProduct, error)

func (*TestUser) CreateSession

func (c *TestUser) CreateSession(ctx context.Context, db *db.DB) (uuid.UUID, error)

Create user session returns uuid is session token

func (*TestUser) HandlerSession

func (c *TestUser) HandlerSession(ctx context.Context, db *db.DB, m *easy.MockHandler) error

func (*TestUser) SelectStatus

func (c *TestUser) SelectStatus(ctx context.Context, db *db.DB, s bool) error

Jump to

Keyboard shortcuts

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