mldtest

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// BaseURL is the test base URL for the service.
	BaseURL = "http://localhost:8080/api/v2/"
	// Iss is the test issuer for the service.
	Iss = BaseURL
	// LogoImageURL is the test service logo for the service.
	LogoImageURL = "http://example.com/logo.png"
	// ServiceName is the test service name for the service.
	ServiceName = "Example service"
	// LogoClickURL is the test service URL for the service.
	LogoClickURL = "http://example.com"
	// LinksExpireAfter is the amount of time links expire after for tests.
	LinksExpireAfter = 24 * 30 * time.Hour
)

Variables

View Source
var (
	// APIKey is the test API key for the service.
	APIKey = uuid.MustParse("40084740-0bc3-455d-b298-e23a31561580")
	// Aud is the test audience for the service.
	Aud = uuid.MustParse("ad9e9d84-92ea-4f07-bac9-5d898d59c83b")
	// ErrMLDTest is the test error for the service.
	ErrMLDTest = errors.New("mldtest")
	// TClaims is the test claims for the service.
	TClaims = TestClaims{Foo: "foo"}
	// SAUUID is the test service account UUID for the service.
	SAUUID = uuid.MustParse("1e079d6d-a8b9-4065-aa8d-86906accd211")
)

Functions

func NewTestStorage

func NewTestStorage(options TestStorageOptions) storage.Storage

NewTestStorage creates a new test storage.

Types

type NopLimiter

type NopLimiter struct{}

NopLimiter is a rate limiter that does nothing.

func (NopLimiter) Wait

func (n NopLimiter) Wait(_ context.Context, _ string) error

Wait implements the rlimit.RateLimiter interface.

type NopProvider

type NopProvider struct{}

NopProvider is an email provider that does nothing.

func (n NopProvider) SendMagicLink(_ context.Context, _ email.Email) error

func (NopProvider) SendOTP added in v0.6.0

func (n NopProvider) SendOTP(_ context.Context, _ email.Email) error

type TestClaims

type TestClaims struct {
	Foo string `json:"foo"`
}

TestClaims is the test claims for the service.

func (TestClaims) Equal

func (t TestClaims) Equal(c TestClaims) bool

Equal returns true if the two claims are equal.

func (TestClaims) GetAudience added in v0.5.1

func (t TestClaims) GetAudience() (jwt.ClaimStrings, error)

func (TestClaims) GetExpirationTime added in v0.5.1

func (t TestClaims) GetExpirationTime() (*jwt.NumericDate, error)

func (TestClaims) GetIssuedAt added in v0.5.1

func (t TestClaims) GetIssuedAt() (*jwt.NumericDate, error)

func (TestClaims) GetIssuer added in v0.5.1

func (t TestClaims) GetIssuer() (string, error)

func (TestClaims) GetNotBefore added in v0.5.1

func (t TestClaims) GetNotBefore() (*jwt.NumericDate, error)

func (TestClaims) GetSubject added in v0.5.1

func (t TestClaims) GetSubject() (string, error)

type TestStorageOptions

type TestStorageOptions struct {
	Key   ed25519.PrivateKey
	KeyID string
	SA    model.ServiceAccount
}

TestStorageOptions are the options for creating a test storage.

Jump to

Keyboard shortcuts

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