helpers

package
v0.1.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const BuiltinSchemaBaseURL = "https://test.example.schemas.com/schemas"

Variables

Functions

func CreateSessionUsingPassword

func CreateSessionUsingPassword(t *testing.T,
	authAttempts service.AuthAttemptService,
	sessionService service.SessionService,
	projectID string, userEmail string, userPassword string) (*domain.Session, error)

func MustMarshal

func MustMarshal(t *testing.T, v any) string

func MustUnmarshal

func MustUnmarshal[T any](t *testing.T, bs []byte) *T

Types

type ApiClient

type ApiClient struct {
	*api.Client
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(
	serverURL string,
) (*ApiClient, error)

func (*ApiClient) SetPassword

func (c *ApiClient) SetPassword(password string)

func (*ApiClient) SetRoles

func (c *ApiClient) SetRoles(roles []string)

func (*ApiClient) SetScopes

func (c *ApiClient) SetScopes(scopes []string)

func (*ApiClient) SetToken

func (c *ApiClient) SetToken(token string)

func (*ApiClient) SetUsername

func (c *ApiClient) SetUsername(username string)

type FakeSecuritySource

type FakeSecuritySource struct {
	Token  string
	Scopes []string

	Username string
	Password string
	Roles    []string
}

func (FakeSecuritySource) OAuth2

func (f FakeSecuritySource) OAuth2(ctx context.Context, operationName api.OperationName) (api.OAuth2, error)

func (FakeSecuritySource) UsernamePassword

func (f FakeSecuritySource) UsernamePassword(ctx context.Context, operationName api.OperationName) (api.UsernamePassword, error)

type Harness

type Harness struct {
	EncryptionKey []byte
	SigningKey    *rsa.PrivateKey

	DBPool               database.Pool
	HttpClient           *http.Client
	TestServer           *httptest.Server
	Hasher               *crypto.PasswapHasher
	Crypter              crypto.Crypter
	SecretGenerator      secrets.Generator
	JWTGenerator         *tokengen.JWTGenerator
	OpaqueTokenGenerator *tokengen.OpaqueTokenGenerator
	TokenVerifier        *tokengen.AnyTokenTypeVerifier
	JoseSigner           jose.Signer

	GeneratedServer *generated.Server
	Handler         *api.Handler
	SecurityHandler *api.SecurityHandler

	SchemaService         *service.SchemaService
	SessionService        service.SessionService
	FlowService           service.FlowService
	AuthAttemptService    service.AuthAttemptService
	ProjectService        service.ProjectService
	FlowDefinitionService service.FlowDefinitionService
	UserService           *service.UserService
	FlowStateMachine      *domain.FlowStateMachineRuntime
	TeamService           *service.TeamService

	SchemaRepo         domain.JSONSchemaRepository
	SchemaResolver     *domain.JSONSchemaResolver
	SchemaValidator    *domain.SchemaValidator
	FlowDefinitionRepo domain.FlowDefinitionRepository
	AuthAttemptRepo    domain.AuthAttemptRepository
	SessionRepo        domain.SessionRepository
	ProjectRepo        domain.ProjectRepository
	UserRepo           domain.UserRepository
	UserPasswordRepo   domain.UserPasswordRepository
	UserPasskeyRepo    domain.UserPasskeyRepository
	TeamRepo           domain.TeamRepository

	TestData test_data.TestData
}

func (*Harness) CreateUserSchema

func (h *Harness) CreateUserSchema(t *testing.T, project *domain.Project, schema string) string

func (*Harness) EnsureAnyTokenVerifier

func (h *Harness) EnsureAnyTokenVerifier(t *testing.T) *tokengen.AnyTokenTypeVerifier

func (*Harness) EnsureAuthAttemptRepo

func (h *Harness) EnsureAuthAttemptRepo(t *testing.T) domain.AuthAttemptRepository

func (*Harness) EnsureAuthAttemptService

func (h *Harness) EnsureAuthAttemptService(t *testing.T) service.AuthAttemptService

func (*Harness) EnsureCreateUserHandler

func (h *Harness) EnsureCreateUserHandler(t *testing.T) *service.FlowCreateUserWithPasswordHandler

func (*Harness) EnsureCrypter

func (h *Harness) EnsureCrypter(t *testing.T) crypto.Crypter

func (*Harness) EnsureDBPool

func (h *Harness) EnsureDBPool(t *testing.T) database.Pool

func (*Harness) EnsureDecrypter

func (h *Harness) EnsureDecrypter(t *testing.T) crypto.Decrypter

func (*Harness) EnsureEncrypter

func (h *Harness) EnsureEncrypter(t *testing.T) crypto.Encrypter

func (*Harness) EnsureEncryptionKey

func (h *Harness) EnsureEncryptionKey(t *testing.T) [32]byte

func (*Harness) EnsureFlowCreateUserForPasskeyHandler

func (h *Harness) EnsureFlowCreateUserForPasskeyHandler(t *testing.T) *service.FlowCreateUserForPasskeyHandler

func (*Harness) EnsureFlowDefinitionRepo

func (h *Harness) EnsureFlowDefinitionRepo(t *testing.T) domain.FlowDefinitionRepository

func (*Harness) EnsureFlowDefinitionService

func (h *Harness) EnsureFlowDefinitionService(t *testing.T) service.FlowDefinitionService

func (*Harness) EnsureFlowService

func (h *Harness) EnsureFlowService(t *testing.T) service.FlowService

func (*Harness) EnsureFlowStateMachine

func (h *Harness) EnsureFlowStateMachine(t *testing.T) *domain.FlowStateMachineRuntime

func (*Harness) EnsureGeneratedServer

func (h *Harness) EnsureGeneratedServer(t *testing.T) *generated.Server

func (*Harness) EnsureHandler

func (h *Harness) EnsureHandler(t *testing.T) *api.Handler

func (*Harness) EnsureHashValidator

func (h *Harness) EnsureHashValidator(t *testing.T) crypto.HashValidator

func (*Harness) EnsureHashVerifier

func (h *Harness) EnsureHashVerifier(t *testing.T) crypto.HashVerifier

func (*Harness) EnsureHasher

func (h *Harness) EnsureHasher(t *testing.T) crypto.Hasher

func (*Harness) EnsureHttpClient

func (h *Harness) EnsureHttpClient(t *testing.T) *http.Client

func (*Harness) EnsureJWTGenerator

func (h *Harness) EnsureJWTGenerator(t *testing.T) *tokengen.JWTGenerator

func (*Harness) EnsureJoseSigner

func (h *Harness) EnsureJoseSigner(t *testing.T) jose.Signer

func (*Harness) EnsureOpaqueTokenGenerator

func (h *Harness) EnsureOpaqueTokenGenerator(t *testing.T) *tokengen.OpaqueTokenGenerator

func (*Harness) EnsurePasskeyRegistrationService

func (h *Harness) EnsurePasskeyRegistrationService(t *testing.T) *service.PasskeyRegistrationService

func (*Harness) EnsureProjectRepo

func (h *Harness) EnsureProjectRepo(t *testing.T) domain.ProjectRepository

func (*Harness) EnsureProjectService

func (h *Harness) EnsureProjectService(t *testing.T) service.ProjectService

func (*Harness) EnsureSchemaRepo

func (h *Harness) EnsureSchemaRepo(t *testing.T) domain.JSONSchemaRepository

func (*Harness) EnsureSchemaResolver

func (h *Harness) EnsureSchemaResolver(t *testing.T) *domain.JSONSchemaResolver

func (*Harness) EnsureSchemaService

func (h *Harness) EnsureSchemaService(t *testing.T) *service.SchemaService

func (*Harness) EnsureSchemaValidator

func (h *Harness) EnsureSchemaValidator(t *testing.T) *domain.SchemaValidator

func (*Harness) EnsureSecretGenerator

func (h *Harness) EnsureSecretGenerator(t *testing.T) secrets.Generator

func (*Harness) EnsureSecurityHandler

func (h *Harness) EnsureSecurityHandler(t *testing.T) *api.SecurityHandler

func (*Harness) EnsureSessionRepo

func (h *Harness) EnsureSessionRepo(t *testing.T) domain.SessionRepository

func (*Harness) EnsureSessionService

func (h *Harness) EnsureSessionService(t *testing.T) service.SessionService

func (*Harness) EnsureSigningKey

func (h *Harness) EnsureSigningKey(t *testing.T) *rsa.PrivateKey

func (*Harness) EnsureTeamRepo

func (h *Harness) EnsureTeamRepo(t *testing.T) domain.TeamRepository

func (*Harness) EnsureTeamService

func (h *Harness) EnsureTeamService(t *testing.T) *service.TeamService

func (*Harness) EnsureTestServer

func (h *Harness) EnsureTestServer(t *testing.T) *httptest.Server

func (*Harness) EnsureUserPasskeyRepo

func (h *Harness) EnsureUserPasskeyRepo(t *testing.T) domain.UserPasskeyRepository

func (*Harness) EnsureUserPasswordRepo

func (h *Harness) EnsureUserPasswordRepo(t *testing.T) domain.UserPasswordRepository

func (*Harness) EnsureUserRepo

func (h *Harness) EnsureUserRepo(t *testing.T) domain.UserRepository

func (*Harness) EnsureUserService

func (h *Harness) EnsureUserService(t *testing.T) *service.UserService

Jump to

Keyboard shortcuts

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