mldtest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURL is the test base URL for the service.
	BaseURL = "http://localhost:8080/api/v1/"
	// 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"
)

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 ErrorLimiter

type ErrorLimiter struct{}

ErrorLimiter is a rate limiter that always returns an error.

func (ErrorLimiter) Wait

func (e ErrorLimiter) Wait(_ context.Context, _ string) error

Wait implements the rlimit.RateLimiter interface.

type ErrorProvider

type ErrorProvider struct{}

ErrorProvider is an email provider that always returns an error.

func (ErrorProvider) Send

Send implements the email.Provider interface.

type ErrorStorage

type ErrorStorage struct{}

ErrorStorage is a storage.Storage implementation that always returns an error.

func (ErrorStorage) Begin

func (e ErrorStorage) Begin(_ context.Context) (storage.Tx, error)

func (ErrorStorage) Close

func (e ErrorStorage) Close(_ context.Context) error

func (ErrorStorage) CreateAdminSA

func (ErrorStorage) DeleteKey

func (e ErrorStorage) DeleteKey(_ context.Context, _ string) (ok bool, err error)

func (ErrorStorage) ReadSA

func (ErrorStorage) ReadSAFromAPIKey

func (e ErrorStorage) ReadSAFromAPIKey(_ context.Context, _ uuid.UUID) (model.ServiceAccount, error)

func (ErrorStorage) SnapshotKeys

func (ErrorStorage) TestingTruncate

func (e ErrorStorage) TestingTruncate(_ context.Context) error

func (ErrorStorage) UpdateDefaultSigningKey

func (e ErrorStorage) UpdateDefaultSigningKey(_ context.Context, _ string) error

func (ErrorStorage) WriteKey

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 (NopProvider) Send

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

Send implements the email.Provider interface.

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) Valid

func (t TestClaims) Valid() error

Valid implements the jwt.Claims interface.

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