test

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: AGPL-3.0 Imports: 21 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"},
	},
	Passcode: config.Passcode{
		Smtp: config.SMTP{
			Host: "localhost",
			Port: "2500",
		},
		Email: config.Email{
			FromAddress: "test@hanko.io",
			FromName:    "Hanko Test",
		},
		TTL: 300,
	},
	Session: config.Session{
		Lifespan: "1h",
		Cookie: config.Cookie{
			SameSite: "none",
		},
	},
	Service: config.Service{
		Name: "Test",
	},
	Account: config.Account{
		AllowSignup:   true,
		AllowDeletion: false,
	},
}
View Source
var UnknownDialectError = errors.New("unknown dialect")

Functions

func NewAuditLogPersister

func NewAuditLogPersister(init []models.AuditLog) persistence.AuditLogPersister

func NewAuditLogger

func NewAuditLogger() auditlog.Logger

func NewEmailPersister

func NewEmailPersister(init []models.Email) persistence.EmailPersister

func NewIdentityPersister added in v0.5.0

func NewIdentityPersister(init []models.Identity) persistence.IdentityPersister

func NewJwkPersister

func NewJwkPersister(init []models.Jwk) persistence.JwkPersister

func NewPasscodePersister

func NewPasscodePersister(init []models.Passcode) persistence.PasscodePersister

func NewPersister

func NewPersister(user []models.User, passcodes []models.Passcode, jwks []models.Jwk, credentials []models.WebauthnCredential, sessionData []models.WebauthnSessionData, passwords []models.PasswordCredential, auditLogs []models.AuditLog, emails []models.Email, primaryEmails []models.PrimaryEmail, identities []models.Identity, tokens []models.Token) persistence.Persister

func NewTokenPersister added in v0.6.0

func NewTokenPersister(init []models.Token) persistence.TokenPersister

func NewUserPersister

func NewUserPersister(init []models.User) persistence.UserPersister

func PurgeDB added in v0.5.0

func PurgeDB(db *TestDB) error

PurgeDB stops the docker container.

Types

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     *smtpmock.Server
	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.

Jump to

Keyboard shortcuts

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