test

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = config.Config{
	Webauthn: config.WebauthnSettings{
		RelyingParty: config.RelyingParty{
			Id:          "localhost",
			DisplayName: "Test Relying Party",
			Icon:        "",
			Origins:     []string{"http://localhost:8080", "http://localhost:8888"},
		},
		Timeout:          60000,
		UserVerification: "preferred",
	},
	Secrets: config.Secrets{
		Keys: []string{"abcdefghijklmnop"},
	},
	Email: config.Email{
		Enabled:              true,
		UseForAuthentication: true,
	},
	EmailDelivery: config.EmailDelivery{
		Enabled: true,
		SMTP: config.SMTP{
			Host: "localhost",
			Port: "2500",
		},
		FromAddress: "test@hanko.io",
		FromName:    "Hanko Test",
	},
	Passcode: config.Passcode{
		TTL: 300,
	},
	Session: config.Session{
		Lifespan: "1h",
		Cookie: config.Cookie{
			SameSite: "none",
		},
		Limit: 5,
	},
	Service: config.Service{
		Name: "Test",
	},
	Account: config.Account{
		AllowSignup:   true,
		AllowDeletion: false,
	},
	Passkey: config.Passkey{
		Enabled:          true,
		UserVerification: "preferred",
	},
}
View Source
var UnknownDialectError = errors.New("unknown dialect")

Functions

func NewAuditLogger

func NewAuditLogger() auditlog.Logger

func PurgeDB added in v0.5.0

func PurgeDB(db *TestDB) error

PurgeDB stops the docker container.

func PurgeMailslurper added in v0.9.1

func PurgeMailslurper(instance *TestMailslurper) error

Types

type DeleteEmailsRequest added in v0.9.1

type DeleteEmailsRequest struct {
	PruneCode string `json:"pruneCode" required:"true"`
}

type GetEmailResponse added in v0.9.1

type GetEmailResponse struct {
	MailItems    []GetEmailResponseMailItem `json:"mailItems"`
	TotalRecords int                        `json:"totalRecords"`
}

type GetEmailResponseMailItem added in v0.9.1

type GetEmailResponseMailItem struct {
	Id          string   `json:"id"`
	DateSent    string   `json:"dateSent"`
	FromAddress string   `json:"fromAddress"`
	ToAddresses []string `json:"toAddresses"`
	Subject     string   `json:"subject"`
	Body        string   `json:"body"`
	ContentType string   `json:"contentType"`
}

type JwkManager added in v0.5.0

type JwkManager struct{}

func (JwkManager) GenerateKey added in v0.5.0

func (m JwkManager) GenerateKey() (jwk.Key, error)

func (JwkManager) GetPublicKeys added in v0.5.0

func (m JwkManager) GetPublicKeys() (jwk.Set, error)

func (JwkManager) GetSigningKey added in v0.5.0

func (m JwkManager) GetSigningKey() (jwk.Key, error)

type Suite added in v0.6.0

type Suite struct {
	suite.Suite
	Storage         persistence.Storage
	DB              *TestDB
	EmailServer     *TestMailslurper
	Name            string // used for database docker container name, so that tests can run in parallel
	WithEmailServer bool
}

func (*Suite) LoadFixtures added in v0.6.0

func (s *Suite) LoadFixtures(path string) error

LoadFixtures loads predefined data from the path in the database.

func (*Suite) SetupSuite added in v0.6.0

func (s *Suite) SetupSuite()

func (*Suite) SetupTest added in v0.6.0

func (s *Suite) SetupTest()

func (*Suite) TearDownSuite added in v0.6.0

func (s *Suite) TearDownSuite()

func (*Suite) TearDownTest added in v0.6.0

func (s *Suite) TearDownTest()

type TestDB added in v0.5.0

type TestDB struct {
	DatabaseUrl string
	DbCon       *sql.DB
	Dialect     string
	// contains filtered or unexported fields
}

func StartDB added in v0.5.0

func StartDB(name string, dialect string) (*TestDB, error)

StartDB starts a database in a docker container with the specified dialect and name. The name is used to name the container, so that multiple container can be started in parallel.

type TestMailslurper added in v0.9.1

type TestMailslurper struct {
	Id string

	SmtpHost string
	SmtpPort string
	// contains filtered or unexported fields
}

func StartMailslurper added in v0.9.1

func StartMailslurper() (*TestMailslurper, error)

func (*TestMailslurper) DeleteEmails added in v0.9.1

func (m *TestMailslurper) DeleteEmails() error

func (*TestMailslurper) GetEmails added in v0.9.1

func (m *TestMailslurper) GetEmails() (*GetEmailResponse, error)

Jump to

Keyboard shortcuts

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