testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFakeQueryExecutorNotConfigured = xerror.Unexpected().Detail(
	"fake query executor not configured",
)

Functions

func AdmitProofEvidence

func AdmitProofEvidence(t *testing.T, request proofevidence.Request) proofevidence.Grant

func ProofEvidenceRequest

func ProofEvidenceRequest() proofevidence.Request

ProofEvidenceRequest provides complete identities for service-boundary tests.

func ProofMetadataClient

func ProofMetadataClient(t *testing.T, plan proofevidence.MetadataPlan, baseURL string) proofevidence.MetadataIO

ProofMetadataClient directs an observer's exact requests to a local provider fixture without adding endpoint overrides to production observation code.

func StubUserPublic

func StubUserPublic(userSlug slug.Slug, fullName, email string, role model.Role) *users.UserPublic

StubUserPublic returns a minimal UserPublic for use in tests.

Types

type FakeClock

type FakeClock struct {
	NowFn func() time.Time
}

func (FakeClock) Now

func (f FakeClock) Now() time.Time

type FakeConnectorFactory

type FakeConnectorFactory struct {
	NewConnectorFn connector.NewConnectorFunc
}

FakeConnectorFactory is a test double that provides a NewConnectorFunc for testing.

func NewFakeConnectorFactory

func NewFakeConnectorFactory() *FakeConnectorFactory

NewFakeConnectorFactory creates a new test double with a default no-op connector factory

type FakeDataSourceRepo

type FakeDataSourceRepo struct {
	CreateFn                                func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, params *repods.CreateParams) (*repods.DataSource, error)
	FindBySlugFn                            func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.DataSource, error)
	IsSlugReservedFn                        func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (bool, error)
	ListByOrgFn                             func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest) ([]*repods.DataSource, error)
	UpdateFn                                func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *repods.UpdateParams) (*repods.DataSource, error)
	UpdateCredentialsFn                     func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *repods.UpdateCredentialsParams) (*repods.DataSource, error)
	MarkTestSuccessFn                       func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *repods.MarkTestSuccessParams) (*repods.DataSource, error)
	MarkTestFailureFn                       func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, expectedRevision int64, errMsg string, schema json.RawMessage) (*repods.DataSource, error)
	DeleteFn                                func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
	DataSourceHasProjectBackendReferencesFn func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (bool, error)
	LockDataSourceForUpdateFn               func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
	RestoreFn                               func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
	SetReadOnlyFn                           func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, readOnly bool) error
}

FakeDataSourceRepo is a test double for datasources.Repository

func NewFakeDataSourceRepo

func NewFakeDataSourceRepo() *FakeDataSourceRepo

NewFakeDataSourceRepo creates a new test double

func (*FakeDataSourceRepo) Create

func (f *FakeDataSourceRepo) Create(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	params *repods.CreateParams,
) (*repods.DataSource, error)

func (*FakeDataSourceRepo) DataSourceHasProjectBackendReferences

func (f *FakeDataSourceRepo) DataSourceHasProjectBackendReferences(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (bool, error)

func (*FakeDataSourceRepo) Delete

func (f *FakeDataSourceRepo) Delete(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) error

func (*FakeDataSourceRepo) FindBySlug

func (f *FakeDataSourceRepo) FindBySlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (*repods.DataSource, error)

func (*FakeDataSourceRepo) IsSlugReserved

func (f *FakeDataSourceRepo) IsSlugReserved(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (bool, error)

IsSlugReserved reports configured active-or-deleted slug reservations for service tests.

func (*FakeDataSourceRepo) ListByOrg

func (f *FakeDataSourceRepo) ListByOrg(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	req model.ListRequest,
) ([]*repods.DataSource, error)

func (*FakeDataSourceRepo) LockDataSourceForUpdate

func (f *FakeDataSourceRepo) LockDataSourceForUpdate(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) error

func (*FakeDataSourceRepo) MarkTestFailure

func (f *FakeDataSourceRepo) MarkTestFailure(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	expectedRevision int64,
	errMsg string,
	schema json.RawMessage,
) (*repods.DataSource, error)

func (*FakeDataSourceRepo) MarkTestSuccess

func (f *FakeDataSourceRepo) MarkTestSuccess(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *repods.MarkTestSuccessParams,
) (*repods.DataSource, error)

func (*FakeDataSourceRepo) Restore

func (f *FakeDataSourceRepo) Restore(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) error

func (*FakeDataSourceRepo) SetReadOnly

func (f *FakeDataSourceRepo) SetReadOnly(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	readOnly bool,
) error

func (*FakeDataSourceRepo) Update

func (f *FakeDataSourceRepo) Update(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *repods.UpdateParams,
) (*repods.DataSource, error)

func (*FakeDataSourceRepo) UpdateCredentials

func (f *FakeDataSourceRepo) UpdateCredentials(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *repods.UpdateCredentialsParams,
) (*repods.DataSource, error)

type FakeEmailProducer

type FakeEmailProducer struct {
	EnqueueEmailVerificationFn func(ctx context.Context, tx postgres.DBTX, user *model.User, verificationURL, token string) (queue.QueuedJob, error)
	EnqueuePasswordResetFn     func(ctx context.Context, tx postgres.DBTX, user *model.User, resetURL, token string) (queue.QueuedJob, error)
	EnqueueSessionMFAFn        func(ctx context.Context, tx postgres.DBTX, user *model.User, code string) (queue.QueuedJob, error)
	EnqueueMemberInvitationFn  func(ctx context.Context, tx postgres.DBTX, invitation model.MemberInvitationEmail, acceptanceURL, token string) (queue.QueuedJob, error)
	EnqueueNotificationFn      func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, recipient model.NotificationEmailRecipient, notification model.NotificationEmail, alertDeliveryAttemptSlug slug.Slug) (queue.QueuedJob, error)
	EnqueueMessageFn           func(ctx context.Context, tx postgres.DBTX, user *model.User, subject, body string) (queue.QueuedJob, error)

	EnqueueEmailVerificationCalls int
	LastEmailVerificationTx       postgres.DBTX
	LastEmailVerificationUser     *model.User
	LastEmailVerificationLink     string
	LastEmailVerificationURL      string
	LastEmailVerificationToken    string

	EnqueuePasswordResetCalls int
	LastPasswordResetTx       postgres.DBTX
	LastPasswordResetUser     *model.User
	LastPasswordResetLink     string
	LastPasswordResetURL      string
	LastPasswordResetToken    string

	EnqueueMemberInvitationCalls int
	LastMemberInvitationTx       postgres.DBTX
	LastMemberInvitation         model.MemberInvitationEmail
	LastMemberInvitationLink     string
	LastMemberInvitationURL      string
	LastMemberInvitationToken    string

	EnqueueSessionMFACalls int
	LastSessionMFATx       postgres.DBTX
	LastSessionMFAUser     *model.User
	LastSessionMFACode     string

	EnqueueMessageCalls int
	LastMessageTx       postgres.DBTX
	LastMessageUser     *model.User
	LastMessageSubject  string
	LastMessageBody     string

	EnqueueNotificationCalls     int
	LastNotificationTx           postgres.DBTX
	LastNotificationOrgSlug      slug.Slug
	LastNotificationRecipient    model.NotificationEmailRecipient
	LastNotification             model.NotificationEmail
	LastAlertDeliveryAttemptSlug slug.Slug
}

FakeEmailProducer is a test double for workerproducer.EmailProducer. By default enqueue methods record their inputs and return a queued outcome.

func (*FakeEmailProducer) EnqueueEmailVerification

func (f *FakeEmailProducer) EnqueueEmailVerification(
	ctx context.Context,
	tx postgres.DBTX,
	user *model.User,
	verificationURL string,
	token string,
) (queue.QueuedJob, error)

func (*FakeEmailProducer) EnqueueMemberInvitation

func (f *FakeEmailProducer) EnqueueMemberInvitation(
	ctx context.Context,
	tx postgres.DBTX,
	invitation model.MemberInvitationEmail,
	acceptanceURL string,
	token string,
) (queue.QueuedJob, error)

func (*FakeEmailProducer) EnqueueMessage

func (f *FakeEmailProducer) EnqueueMessage(
	ctx context.Context,
	tx postgres.DBTX,
	user *model.User,
	subject, body string,
) (queue.QueuedJob, error)

func (*FakeEmailProducer) EnqueueNotification

func (f *FakeEmailProducer) EnqueueNotification(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	recipient model.NotificationEmailRecipient,
	notification model.NotificationEmail,
	alertDeliveryAttemptSlug slug.Slug,
) (queue.QueuedJob, error)

func (*FakeEmailProducer) EnqueuePasswordReset

func (f *FakeEmailProducer) EnqueuePasswordReset(
	ctx context.Context,
	tx postgres.DBTX,
	user *model.User,
	resetURL string,
	token string,
) (queue.QueuedJob, error)

func (*FakeEmailProducer) EnqueueSessionMFA

func (f *FakeEmailProducer) EnqueueSessionMFA(
	ctx context.Context,
	tx postgres.DBTX,
	user *model.User,
	code string,
) (queue.QueuedJob, error)

type FakeEmailService

type FakeEmailService struct {
	EmailVerificationFn func(ctx context.Context, user *model.User, verificationLink string) error
	PasswordResetFn     func(ctx context.Context, user *model.User, resetLink string) error
	SessionMFAFn        func(ctx context.Context, user *model.User, code string) error
	MemberInvitationFn  func(ctx context.Context, invitation model.MemberInvitationEmail, acceptanceLink string) error
	NotificationFn      func(ctx context.Context, recipient model.NotificationEmailRecipient, notification model.NotificationEmail) error
	MessageFn           func(ctx context.Context, user *model.User, subject, body string) error
}

FakeEmailService is a test double for email.Service. By default EmailVerification succeeds without side effects.

func (*FakeEmailService) EmailVerification

func (f *FakeEmailService) EmailVerification(
	ctx context.Context,
	user *model.User,
	verificationLink string,
) error

func (*FakeEmailService) MemberInvitation

func (f *FakeEmailService) MemberInvitation(
	ctx context.Context,
	invitation model.MemberInvitationEmail,
	acceptanceLink string,
) error

func (*FakeEmailService) Message

func (f *FakeEmailService) Message(
	ctx context.Context,
	user *model.User,
	subject, body string,
) error

func (*FakeEmailService) Notification

func (f *FakeEmailService) Notification(
	ctx context.Context,
	recipient model.NotificationEmailRecipient,
	notification model.NotificationEmail,
) error

func (*FakeEmailService) PasswordReset

func (f *FakeEmailService) PasswordReset(
	ctx context.Context,
	user *model.User,
	resetLink string,
) error

func (*FakeEmailService) SessionMFA

func (f *FakeEmailService) SessionMFA(
	ctx context.Context,
	user *model.User,
	code string,
) error

type FakeEncryptor

type FakeEncryptor struct {
	EncryptFn func(plaintext []byte) ([]byte, error)
	DecryptFn func(ciphertext []byte) ([]byte, error)
}

FakeEncryptor is a test double for AES encryption

func NewFakeEncryptor

func NewFakeEncryptor() *FakeEncryptor

NewFakeEncryptor creates a new test double

func (*FakeEncryptor) Decrypt

func (f *FakeEncryptor) Decrypt(ciphertext []byte) ([]byte, error)

func (*FakeEncryptor) Encrypt

func (f *FakeEncryptor) Encrypt(plaintext []byte) ([]byte, error)

func (*FakeEncryptor) Open

func (f *FakeEncryptor) Open(_ crypto.CredentialScope, ciphertext []byte) ([]byte, error)

func (*FakeEncryptor) Seal

func (f *FakeEncryptor) Seal(_ crypto.CredentialScope, plaintext []byte) ([]byte, error)

type FakeHasher

type FakeHasher struct {
	HashFn        func(input string) (string, error)
	CompareHashFn func(input, hash string) (bool, error)
}

FakeHasher is a test double for crypto.Hasher. By default it returns the input unchanged (identity hash).

func (*FakeHasher) CompareHash

func (f *FakeHasher) CompareHash(input, hash string) (bool, error)

func (*FakeHasher) Hash

func (f *FakeHasher) Hash(input string) (string, error)

type FakeMemberInvitationsRepo

type FakeMemberInvitationsRepo struct {
	CreateFn                      func(ctx context.Context, tx postgres.DBTX, params memberinvitations.CreateParams) (*memberinvitations.Invitation, error)
	FindFn                        func(ctx context.Context, tx postgres.DBTX, orgSlug, invitationSlug slug.Slug) (*memberinvitations.Invitation, error)
	FindByTokenHashFn             func(ctx context.Context, tx postgres.DBTX, tokenHash string) (*memberinvitations.Invitation, error)
	FindPendingByEmailFn          func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (*memberinvitations.Invitation, error)
	ListByOrganizationFn          func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest) ([]*memberinvitations.Invitation, error)
	ExpirePendingByOrganizationFn func(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		expiredAt time.Time,
	) ([]*memberinvitations.Invitation, error)
	ListPendingByEmailFn func(ctx context.Context, tx postgres.DBTX, email string, asOf time.Time) ([]*memberinvitations.Invitation, error)
	RefreshTokenFn       func(ctx context.Context, tx postgres.DBTX, params memberinvitations.RefreshTokenParams) (*memberinvitations.Invitation, error)
	MarkAcceptedFn       func(ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkAcceptedParams) (*memberinvitations.Invitation, error)
	MarkDeclinedFn       func(ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkDeclinedParams) (*memberinvitations.Invitation, error)
	MarkRevokedFn        func(ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkRevokedParams) (*memberinvitations.Invitation, error)
	MarkExpiredFn        func(ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkExpiredParams) (*memberinvitations.Invitation, error)
}

FakeMemberInvitationsRepo is a test double for memberinvitations.Repository.

func (*FakeMemberInvitationsRepo) Create

func (*FakeMemberInvitationsRepo) ExpirePendingByOrganization

func (f *FakeMemberInvitationsRepo) ExpirePendingByOrganization(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	expiredAt time.Time,
) ([]*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) Find

func (f *FakeMemberInvitationsRepo) Find(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, invitationSlug slug.Slug,
) (*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) FindByTokenHash

func (f *FakeMemberInvitationsRepo) FindByTokenHash(
	ctx context.Context,
	tx postgres.DBTX,
	tokenHash string,
) (*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) FindPendingByEmail

func (f *FakeMemberInvitationsRepo) FindPendingByEmail(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	email string,
) (*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) ListByOrganization

func (f *FakeMemberInvitationsRepo) ListByOrganization(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	req model.ListRequest,
) ([]*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) ListPendingByEmail

func (f *FakeMemberInvitationsRepo) ListPendingByEmail(
	ctx context.Context,
	tx postgres.DBTX,
	email string,
	asOf time.Time,
) ([]*memberinvitations.Invitation, error)

func (*FakeMemberInvitationsRepo) MarkAccepted

func (*FakeMemberInvitationsRepo) MarkDeclined

func (*FakeMemberInvitationsRepo) MarkExpired

func (*FakeMemberInvitationsRepo) MarkRevoked

func (*FakeMemberInvitationsRepo) RefreshToken

type FakeMembersRepo

type FakeMembersRepo struct {
	CreateFn              func(ctx context.Context, tx postgres.DBTX, p *members.CreateParams) (*members.Member, error)
	FindFn                func(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) (*members.Member, error)
	FindByEmailFn         func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (*members.Member, error)
	CountByOrganizationFn func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug) (int64, error)
	CountByRoleFn         func(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) (int64, error)
	ListByOrganizationFn  func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest) ([]*members.Member, error)
	UpdateFn              func(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug, roleSlug slug.Slug) error
	RemoveFn              func(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) error
}

FakeMembersRepo is a test double for members.Repository.

func (*FakeMembersRepo) CountByOrganization

func (f *FakeMembersRepo) CountByOrganization(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
) (int64, error)

func (*FakeMembersRepo) CountByRole

func (f *FakeMembersRepo) CountByRole(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, roleSlug slug.Slug,
) (int64, error)

func (*FakeMembersRepo) Create

func (*FakeMembersRepo) Find

func (f *FakeMembersRepo) Find(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, userSlug slug.Slug,
) (*members.Member, error)

func (*FakeMembersRepo) FindByEmail

func (f *FakeMembersRepo) FindByEmail(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	email string,
) (*members.Member, error)

func (*FakeMembersRepo) ListByOrganization

func (f *FakeMembersRepo) ListByOrganization(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	req model.ListRequest,
) ([]*members.Member, error)

func (*FakeMembersRepo) Remove

func (f *FakeMembersRepo) Remove(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, userSlug slug.Slug,
) error

func (*FakeMembersRepo) Update

func (f *FakeMembersRepo) Update(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, userSlug, roleSlug slug.Slug,
) error

type FakeOperationAdmission

type FakeOperationAdmission struct {
	WithOperationFn        func(context.Context, slug.Slug, slug.Slug, func(context.Context) error) error
	EncodeOperationErrorFn func(error) (string, bool)
	DecodeOperationErrorFn func(string) (error, bool)
}

func (FakeOperationAdmission) DecodeOperationError

func (f FakeOperationAdmission) DecodeOperationError(code string) (error, bool)

func (FakeOperationAdmission) EncodeOperationError

func (f FakeOperationAdmission) EncodeOperationError(err error) (string, bool)

func (FakeOperationAdmission) WithOperation

func (f FakeOperationAdmission) WithOperation(ctx context.Context, org, source slug.Slug, execute func(context.Context) error) error

type FakeOrgsRepo

type FakeOrgsRepo struct {
	DeletionBlockedFn     func(context.Context, postgres.DBTX, slug.Slug) (bool, error)
	DeleteFn              func(context.Context, postgres.DBTX, slug.Slug) error
	CreateFn              func(ctx context.Context, tx postgres.DBTX, p *organizations.CreateParams) (*organizations.Organization, error)
	FindBySlugFn          func(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*organizations.Organization, error)
	FindBySlugForUpdateFn func(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*organizations.Organization, error)
	UpdateFn              func(ctx context.Context, tx postgres.DBTX, p *organizations.UpdateParams) error
	UpdateSettingsFn      func(ctx context.Context, tx postgres.DBTX, p *organizations.UpdateSettingsParams) error
	ListByUserFn          func(ctx context.Context, tx postgres.DBTX, userSlug slug.Slug, req model.ListRequest) ([]*organizations.OrganizationWithRole, error)
}

FakeOrgsRepo is a test double for organizations.Repository.

func (*FakeOrgsRepo) Create

func (*FakeOrgsRepo) Delete

func (f *FakeOrgsRepo) Delete(ctx context.Context, tx postgres.DBTX, s slug.Slug) error

func (*FakeOrgsRepo) DeletionBlocked

func (f *FakeOrgsRepo) DeletionBlocked(ctx context.Context, tx postgres.DBTX, s slug.Slug) (bool, error)

func (*FakeOrgsRepo) FindBySlug

func (f *FakeOrgsRepo) FindBySlug(
	ctx context.Context,
	tx postgres.DBTX,
	s slug.Slug,
) (*organizations.Organization, error)

func (*FakeOrgsRepo) FindBySlugForUpdate

func (f *FakeOrgsRepo) FindBySlugForUpdate(
	ctx context.Context,
	tx postgres.DBTX,
	s slug.Slug,
) (*organizations.Organization, error)

func (*FakeOrgsRepo) ListByUser

func (f *FakeOrgsRepo) ListByUser(
	ctx context.Context,
	tx postgres.DBTX,
	userSlug slug.Slug,
	req model.ListRequest,
) ([]*organizations.OrganizationWithRole, error)

func (*FakeOrgsRepo) Update

func (*FakeOrgsRepo) UpdateSettings

type FakePermissionsRepo

type FakePermissionsRepo struct {
	CreateFn               func(ctx context.Context, tx postgres.DBTX, params *permissions.CreateParams) (*permissions.Permission, error)
	FindOrCreateFn         func(ctx context.Context, tx postgres.DBTX, resources, actions []string) ([]*permissions.Permission, error)
	ListAllFn              func(ctx context.Context, tx postgres.DBTX) ([]*permissions.Permission, error)
	ListForRoleFn          func(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) ([]*permissions.Permission, error)
	AddToRoleFn            func(ctx context.Context, tx postgres.DBTX, p *permissions.AddToRoleParams) error
	RemoveFromRoleFn       func(ctx context.Context, tx postgres.DBTX, p *permissions.RemoveFromRoleParams) error
	ClearRolePermissionsFn func(ctx context.Context, tx postgres.DBTX, p *permissions.ClearRolePermissionsParams) error
}

FakePermissionsRepo is a test double for permissions.Repository.

func (*FakePermissionsRepo) AddToRole

func (*FakePermissionsRepo) ClearRolePermissions

func (*FakePermissionsRepo) Create

func (*FakePermissionsRepo) FindOrCreate

func (f *FakePermissionsRepo) FindOrCreate(
	ctx context.Context,
	tx postgres.DBTX,
	resources, actions []string,
) ([]*permissions.Permission, error)

func (*FakePermissionsRepo) ListAll

func (*FakePermissionsRepo) ListForRole

func (f *FakePermissionsRepo) ListForRole(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, roleSlug slug.Slug,
) ([]*permissions.Permission, error)

func (*FakePermissionsRepo) RemoveFromRole

type FakeQueryExecutor

type FakeQueryExecutor struct {
	ExecuteFn func(
		ctx context.Context,
		orgSlug, dsSlug, querySlug slug.Slug,
		paramValues map[string]any,
	) (*result.ExecutionResult, error)
	ExecuteInlineFn func(
		ctx context.Context,
		orgSlug, dsSlug slug.Slug,
		operationInline map[string]any,
		paramValues map[string]any,
	) (*result.ExecutionResult, error)
}

FakeQueryExecutor is a test double for components that execute saved queries.

func (*FakeQueryExecutor) Execute

func (f *FakeQueryExecutor) Execute(
	ctx context.Context,
	orgSlug, dsSlug, querySlug slug.Slug,
	paramValues map[string]any,
) (*result.ExecutionResult, error)

func (*FakeQueryExecutor) ExecuteInline

func (f *FakeQueryExecutor) ExecuteInline(
	ctx context.Context,
	orgSlug, dsSlug slug.Slug,
	operationInline map[string]any,
	paramValues map[string]any,
) (*result.ExecutionResult, error)

type FakeQueryRepository

type FakeQueryRepository struct {
	FindSnapshotFn                  func(context.Context, postgres.DBTX, slug.Slug, slug.Slug, slug.Slug) (*qrepo.OperationSnapshot, error)
	CreateFn                        func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *qrepo.CreateParams) (*qrepo.Query, []*qrepo.QueryParameter, error)
	FindBySlugFn                    func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) (*qrepo.Query, []*qrepo.QueryParameter, error)
	ListByDataSourceFn              func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, req model.ListRequest, includeDeleted bool) ([]*qrepo.Query, error)
	UpdateFn                        func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, params *qrepo.UpdateParams) (*qrepo.Query, []*qrepo.QueryParameter, error)
	DeleteFn                        func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
	RestoreFn                       func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
	PurgeFn                         func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
	CreateExecutionFn               func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, params *qrepo.CreateExecutionParams) (*qrepo.QueryExecution, error)
	ListExecutionsFn                func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, req model.ListRequest) ([]*qrepo.QueryExecution, error)
	GetExecutionFn                  func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug, executionSlug slug.Slug) (*qrepo.QueryExecution, error)
	FindLatestSuccessfulExecutionFn func(context.Context, postgres.DBTX, slug.Slug) (*qrepo.QueryExecutionIdentity, error)
}

FakeQueryRepository is a test double for queries.Repository. By default all methods succeed without side effects.

func (*FakeQueryRepository) Create

func (f *FakeQueryRepository) Create(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *qrepo.CreateParams,
) (*qrepo.Query, []*qrepo.QueryParameter, error)

func (*FakeQueryRepository) CreateExecution

func (f *FakeQueryRepository) CreateExecution(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
	params *qrepo.CreateExecutionParams,
) (*qrepo.QueryExecution, error)

func (*FakeQueryRepository) Delete

func (f *FakeQueryRepository) Delete(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
) error

func (*FakeQueryRepository) FindBySlug

func (f *FakeQueryRepository) FindBySlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
) (*qrepo.Query, []*qrepo.QueryParameter, error)

func (*FakeQueryRepository) FindLatestSuccessfulExecution

func (f *FakeQueryRepository) FindLatestSuccessfulExecution(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
) (*qrepo.QueryExecutionIdentity, error)

func (*FakeQueryRepository) FindSnapshot

func (f *FakeQueryRepository) FindSnapshot(ctx context.Context, db postgres.DBTX, org, source, operation slug.Slug) (*qrepo.OperationSnapshot, error)

func (*FakeQueryRepository) GetExecution

func (f *FakeQueryRepository) GetExecution(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug, executionSlug slug.Slug,
) (*qrepo.QueryExecution, error)

func (*FakeQueryRepository) ListByDataSource

func (f *FakeQueryRepository) ListByDataSource(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	req model.ListRequest,
	includeDeleted bool,
) ([]*qrepo.Query, error)

func (*FakeQueryRepository) ListExecutions

func (f *FakeQueryRepository) ListExecutions(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
	req model.ListRequest,
) ([]*qrepo.QueryExecution, error)

func (*FakeQueryRepository) Purge

func (f *FakeQueryRepository) Purge(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
) error

func (*FakeQueryRepository) Restore

func (f *FakeQueryRepository) Restore(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
) error

func (*FakeQueryRepository) Update

func (f *FakeQueryRepository) Update(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug, querySlug slug.Slug,
	params *qrepo.UpdateParams,
) (*qrepo.Query, []*qrepo.QueryParameter, error)

type FakeRolesRepo

type FakeRolesRepo struct {
	CreateFn                  func(ctx context.Context, tx postgres.DBTX, params *roles.CreateParams) (*roles.Role, error)
	EnsureDefaultFn           func(ctx context.Context, tx postgres.DBTX, params *roles.CreateParams) (*roles.Role, error)
	FindBySlugFn              func(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) (*roles.Role, error)
	ListByOrganizationFn      func(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest, includeDeleted, onlyDeleted bool) ([]*roles.Role, error)
	GetUserPermissionsInOrgFn func(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) ([]*roles.UserPermission, error)
	UpdateFn                  func(ctx context.Context, tx postgres.DBTX, params *roles.UpdateParams) error
	DeleteFn                  func(ctx context.Context, tx postgres.DBTX, params *roles.DeleteParams) error
	RestoreFn                 func(ctx context.Context, tx postgres.DBTX, params *roles.RestoreParams) error
}

FakeRolesRepo is a test double for roles.Repository.

func (*FakeRolesRepo) Create

func (f *FakeRolesRepo) Create(
	ctx context.Context,
	tx postgres.DBTX,
	p *roles.CreateParams,
) (*roles.Role, error)

func (*FakeRolesRepo) Delete

func (*FakeRolesRepo) EnsureDefault

func (f *FakeRolesRepo) EnsureDefault(
	ctx context.Context,
	tx postgres.DBTX,
	p *roles.CreateParams,
) (*roles.Role, error)

func (*FakeRolesRepo) FindBySlug

func (f *FakeRolesRepo) FindBySlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, roleSlug slug.Slug,
) (*roles.Role, error)

func (*FakeRolesRepo) GetUserPermissionsInOrg

func (f *FakeRolesRepo) GetUserPermissionsInOrg(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, userSlug slug.Slug,
) ([]*roles.UserPermission, error)

func (*FakeRolesRepo) ListByOrganization

func (f *FakeRolesRepo) ListByOrganization(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug slug.Slug,
	req model.ListRequest,
	includeDeleted bool,
	onlyDeleted bool,
) ([]*roles.Role, error)

func (*FakeRolesRepo) Restore

func (*FakeRolesRepo) Update

type FakeRunSucceededNotifier

type FakeRunSucceededNotifier struct {
	CandidateFn func(context.Context, postgres.DBTX, model.NotificationCandidate) error
	NotifyFn    func(context.Context, slug.Slug, slug.Slug, slug.Slug, string) error
}

func (FakeRunSucceededNotifier) EnqueueCandidate

func (f FakeRunSucceededNotifier) EnqueueCandidate(ctx context.Context, tx postgres.DBTX, candidate model.NotificationCandidate) error

func (FakeRunSucceededNotifier) NotifyRunSucceeded

func (f FakeRunSucceededNotifier) NotifyRunSucceeded(ctx context.Context, org, project, environment slug.Slug, run string) error

type FakeSQLConnector

type FakeSQLConnector struct {
	TestConnectionFn    func(ctx context.Context) error
	CloseFn             func() error
	ExecuteFn           func(ctx context.Context, queryData json.RawMessage, params map[string]types.TypedParam) (*result.ExecutionResult, error)
	ExecuteWithLimitsFn func(ctx context.Context, queryData json.RawMessage, params map[string]types.TypedParam, limits types.ExecutionLimits) (*result.ExecutionResult, error)
	IntrospectSchemaFn  func(ctx context.Context) (*sql.Schema, error)
	CapabilitiesFn      func() sql.Capabilities
}

FakeSQLConnector is a test double for sql.SQLConnector

func NewFakeSQLConnector

func NewFakeSQLConnector() *FakeSQLConnector

NewFakeSQLConnector creates a new test double for SQL connectors

func (*FakeSQLConnector) Close

func (f *FakeSQLConnector) Close() error

func (*FakeSQLConnector) Execute

func (f *FakeSQLConnector) Execute(
	ctx context.Context,
	queryData json.RawMessage,
	params map[string]types.TypedParam,
	limits ...types.ExecutionLimits,
) (*result.ExecutionResult, error)

func (*FakeSQLConnector) GetCapabilities

func (f *FakeSQLConnector) GetCapabilities() sql.Capabilities

func (*FakeSQLConnector) IntrospectSchema

func (f *FakeSQLConnector) IntrospectSchema(ctx context.Context) (*sql.Schema, error)

func (*FakeSQLConnector) TestConnection

func (f *FakeSQLConnector) TestConnection(ctx context.Context) error

type FakeSchemaMetadataRepo

type FakeSchemaMetadataRepo struct {
	FindByDataSourceSlugFn   func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaMetadata, error)
	DeleteByDataSourceSlugFn func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
	UpsertByDataSourceSlugFn func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *repods.UpsertSchemaMetadataParams) (*repods.SchemaMetadata, error)
	FindImportStateBySlugFn  func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaImportState, error)
	StartImportBySlugFn      func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, attemptID string, startedAt time.Time) (*repods.SchemaImportState, error)
	FindCurrentAttemptFn     func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, attemptID string) (*repods.SchemaImportState, error)
	MarkImportReadyBySlugFn  func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, attemptID string, finishedAt time.Time) (*repods.SchemaImportState, error)
	MarkImportFailedBySlugFn func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, params *repods.MarkSchemaImportFailedParams) (*repods.SchemaImportState, error)
	ResetImportBySlugFn      func(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaImportState, error)
}

FakeSchemaMetadataRepo is a test double for datasources.SchemaMetadataRepository.

func NewFakeSchemaMetadataRepo

func NewFakeSchemaMetadataRepo() *FakeSchemaMetadataRepo

NewFakeSchemaMetadataRepo creates a new test double.

func (*FakeSchemaMetadataRepo) DeleteByDataSourceSlug

func (f *FakeSchemaMetadataRepo) DeleteByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) error

func (*FakeSchemaMetadataRepo) FindByDataSourceSlug

func (f *FakeSchemaMetadataRepo) FindByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (*repods.SchemaMetadata, error)

func (*FakeSchemaMetadataRepo) FindCurrentImportAttemptByDataSourceSlug

func (f *FakeSchemaMetadataRepo) FindCurrentImportAttemptByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	attemptID string,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) FindImportStateByDataSourceSlug

func (f *FakeSchemaMetadataRepo) FindImportStateByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) MarkImportFailedByDataSourceSlug

func (f *FakeSchemaMetadataRepo) MarkImportFailedByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *repods.MarkSchemaImportFailedParams,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) MarkImportReadyByDataSourceSlug

func (f *FakeSchemaMetadataRepo) MarkImportReadyByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	attemptID string,
	finishedAt time.Time,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) ResetImportByDataSourceSlug

func (f *FakeSchemaMetadataRepo) ResetImportByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) StartImportByDataSourceSlug

func (f *FakeSchemaMetadataRepo) StartImportByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	attemptID string,
	startedAt time.Time,
) (*repods.SchemaImportState, error)

func (*FakeSchemaMetadataRepo) UpsertByDataSourceSlug

func (f *FakeSchemaMetadataRepo) UpsertByDataSourceSlug(
	ctx context.Context,
	tx postgres.DBTX,
	orgSlug, dsSlug slug.Slug,
	params *repods.UpsertSchemaMetadataParams,
) (*repods.SchemaMetadata, error)

type FakeSessionLocker

type FakeSessionLocker struct {
	WithLockFn func(context.Context, string, func(context.Context) error) (bool, error)
}

func (*FakeSessionLocker) WithLock

func (f *FakeSessionLocker) WithLock(ctx context.Context, key string, execute func(context.Context) error) (bool, error)

type FakeTransactionManager

type FakeTransactionManager struct {
	Tx postgres.DBTX
}

FakeTransactionManager is a test double for postgres.TransactionManager. It executes the callback directly without opening a real transaction.

func (FakeTransactionManager) RunInTx

func (FakeTransactionManager) RunRead

type FakeUsersRepo

type FakeUsersRepo struct {
	IsSlugReservedFn                func(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (bool, error)
	CreateUserFn                    func(ctx context.Context, tx postgres.DBTX, p *users.CreateParams) (*users.UserPublic, error)
	CreateOIDCUserFn                func(ctx context.Context, tx postgres.DBTX, p *users.CreateOIDCUserParams) (*users.UserPublic, error)
	FindBySlugFn                    func(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*users.UserPublic, error)
	FindByEmailWithPasswordFn       func(ctx context.Context, tx postgres.DBTX, email string) (*users.UserWithPassword, error)
	FindBySlugWithPasswordFn        func(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*users.UserWithPassword, error)
	FindByOIDCProviderFn            func(ctx context.Context, tx postgres.DBTX, provider, providerID string) (*users.UserPublic, error)
	FindByEmailFn                   func(ctx context.Context, tx postgres.DBTX, email string) (*users.UserPublic, error)
	CreateEmailVerificationTokenFn  func(ctx context.Context, tx postgres.DBTX, params users.CreateEmailVerificationTokenParams) error
	CreatePasswordResetTokenFn      func(ctx context.Context, tx postgres.DBTX, params users.CreatePasswordResetTokenParams) error
	CreateMFAChallengeFn            func(ctx context.Context, tx postgres.DBTX, userSlug slug.Slug, challengeTokenHash, codeHash string, expiresAt time.Time) error
	FindMFAChallengeByTokenFn       func(ctx context.Context, tx postgres.DBTX, challengeTokenHash string) (*users.MFAChallenge, error)
	IncrementMFAChallengeAttemptsFn func(ctx context.Context, tx postgres.DBTX, id int) error
	ConsumeMFAChallengeFn           func(ctx context.Context, tx postgres.DBTX, id int) error
	FindByEmailVerificationTokenFn  func(ctx context.Context, tx postgres.DBTX, tokenHash string) (*users.UserPublic, error)
	FindByPasswordResetTokenFn      func(ctx context.Context, tx postgres.DBTX, tokenHash string) (*users.UserPublic, error)
	MarkEmailAsVerifiedFn           func(ctx context.Context, tx postgres.DBTX, slug slug.Slug, verifiedAt time.Time) error
	UpdatePasswordFn                func(ctx context.Context, tx postgres.DBTX, slug slug.Slug, hashedPassword string) error
	UpdateProfileFn                 func(ctx context.Context, tx postgres.DBTX, params *users.UpdateProfileParams) error
}

FakeUsersRepo is a test double for users.Repository. Set each Fn field to control the behavior for that method. Unconfigured methods return an explicit sentinel error to surface unexpected calls.

func (*FakeUsersRepo) ConsumeMFAChallenge

func (f *FakeUsersRepo) ConsumeMFAChallenge(ctx context.Context, tx postgres.DBTX, id int) error

func (*FakeUsersRepo) CreateEmailVerificationToken

func (f *FakeUsersRepo) CreateEmailVerificationToken(
	ctx context.Context,
	tx postgres.DBTX,
	params users.CreateEmailVerificationTokenParams,
) error

func (*FakeUsersRepo) CreateMFAChallenge

func (f *FakeUsersRepo) CreateMFAChallenge(
	ctx context.Context,
	tx postgres.DBTX,
	userSlug slug.Slug,
	challengeTokenHash string,
	codeHash string,
	expiresAt time.Time,
) error

func (*FakeUsersRepo) CreateOIDCUser

func (f *FakeUsersRepo) CreateOIDCUser(
	ctx context.Context,
	tx postgres.DBTX,
	p *users.CreateOIDCUserParams,
) (*users.UserPublic, error)

func (*FakeUsersRepo) CreatePasswordResetToken

func (f *FakeUsersRepo) CreatePasswordResetToken(
	ctx context.Context,
	tx postgres.DBTX,
	params users.CreatePasswordResetTokenParams,
) error

func (*FakeUsersRepo) CreateUser

func (f *FakeUsersRepo) CreateUser(
	ctx context.Context,
	tx postgres.DBTX,
	p *users.CreateParams,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindByEmail

func (f *FakeUsersRepo) FindByEmail(
	ctx context.Context,
	tx postgres.DBTX,
	email string,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindByEmailVerificationToken

func (f *FakeUsersRepo) FindByEmailVerificationToken(
	ctx context.Context,
	tx postgres.DBTX,
	tokenHash string,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindByEmailWithPassword

func (f *FakeUsersRepo) FindByEmailWithPassword(
	ctx context.Context,
	tx postgres.DBTX,
	email string,
) (*users.UserWithPassword, error)

func (*FakeUsersRepo) FindByOIDCProvider

func (f *FakeUsersRepo) FindByOIDCProvider(
	ctx context.Context,
	tx postgres.DBTX,
	provider, providerID string,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindByPasswordResetToken

func (f *FakeUsersRepo) FindByPasswordResetToken(
	ctx context.Context,
	tx postgres.DBTX,
	tokenHash string,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindBySlug

func (f *FakeUsersRepo) FindBySlug(
	ctx context.Context,
	tx postgres.DBTX,
	slug slug.Slug,
) (*users.UserPublic, error)

func (*FakeUsersRepo) FindBySlugWithPassword

func (f *FakeUsersRepo) FindBySlugWithPassword(
	ctx context.Context,
	tx postgres.DBTX,
	slug slug.Slug,
) (*users.UserWithPassword, error)

func (*FakeUsersRepo) FindMFAChallengeByToken

func (f *FakeUsersRepo) FindMFAChallengeByToken(
	ctx context.Context,
	tx postgres.DBTX,
	challengeTokenHash string,
) (*users.MFAChallenge, error)

func (*FakeUsersRepo) IncrementMFAChallengeAttempts

func (f *FakeUsersRepo) IncrementMFAChallengeAttempts(
	ctx context.Context,
	tx postgres.DBTX,
	id int,
) error

func (*FakeUsersRepo) IsSlugReserved

func (f *FakeUsersRepo) IsSlugReserved(ctx context.Context, tx postgres.DBTX, s slug.Slug) (bool, error)

func (*FakeUsersRepo) MarkEmailAsVerified

func (f *FakeUsersRepo) MarkEmailAsVerified(
	ctx context.Context,
	tx postgres.DBTX,
	slug slug.Slug,
	verifiedAt time.Time,
) error

func (*FakeUsersRepo) UpdatePassword

func (f *FakeUsersRepo) UpdatePassword(
	ctx context.Context,
	tx postgres.DBTX,
	slug slug.Slug,
	hashedPassword string,
) error

func (*FakeUsersRepo) UpdateProfile

func (f *FakeUsersRepo) UpdateProfile(
	ctx context.Context,
	tx postgres.DBTX,
	params *users.UpdateProfileParams,
) error

type ProofHTTPTransport

type ProofHTTPTransport struct{ Client *http.Client }

ProofHTTPTransport admits only HTTP in HTTPS observer unit tests.

func (ProofHTTPTransport) BeginNative

func (ProofHTTPTransport) DialContext

func (ProofHTTPTransport) HTTPClient

func (t ProofHTTPTransport) HTTPClient() *http.Client

type ProofNativeTransport

type ProofNativeTransport struct {
	Plan    proofevidence.MetadataPlan
	Address string
	Started bool
	Dials   int
	// contains filtered or unexported fields
}

ProofNativeTransport confines dependency tests to a known local fixture.

func (*ProofNativeTransport) BeginNative

func (t *ProofNativeTransport) BeginNative(route proofevidence.MetadataRoute) error

func (*ProofNativeTransport) DialContext

func (t *ProofNativeTransport) DialContext(ctx context.Context, network, address string) (net.Conn, error)

func (*ProofNativeTransport) HTTPClient

func (t *ProofNativeTransport) HTTPClient() *http.Client

Directories

Path Synopsis
Package containerfixture owns disposable, package-scoped Go E2E dependencies.
Package containerfixture owns disposable, package-scoped Go E2E dependencies.
Package datasourcee2e provides reusable real-Postgres data-source E2E setup.
Package datasourcee2e provides reusable real-Postgres data-source E2E setup.
Package filestreamfixture provides retained input for small hermetic connector tests.
Package filestreamfixture provides retained input for small hermetic connector tests.
Package pipelinefixture materializes pipeline test data through the same Git reconciliation boundary used by production.
Package pipelinefixture materializes pipeline test data through the same Git reconciliation boundary used by production.
Package richcontractfixture supplies synthetic rich-port admission material.
Package richcontractfixture supplies synthetic rich-port admission material.
Package supplierfixture retains the synthetic Supplier Price Desk inputs and independent expectations for unit and connector acceptance tests.
Package supplierfixture retains the synthetic Supplier Price Desk inputs and independent expectations for unit and connector acceptance tests.

Jump to

Keyboard shortcuts

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