Documentation
¶
Index ¶
- Variables
- func AdmitProofEvidence(t *testing.T, request proofevidence.Request) proofevidence.Grant
- func ProofEvidenceRequest() proofevidence.Request
- func ProofMetadataClient(t *testing.T, plan proofevidence.MetadataPlan, baseURL string) proofevidence.MetadataIO
- func StubUserPublic(userSlug slug.Slug, fullName, email string, role model.Role) *users.UserPublic
- type FakeClock
- type FakeConnectorFactory
- type FakeDataSourceRepo
- func (f *FakeDataSourceRepo) Create(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) (*repods.DataSource, error)
- func (f *FakeDataSourceRepo) DataSourceHasProjectBackendReferences(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (bool, error)
- func (f *FakeDataSourceRepo) Delete(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
- func (f *FakeDataSourceRepo) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.DataSource, error)
- func (f *FakeDataSourceRepo) IsSlugReserved(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (bool, error)
- func (f *FakeDataSourceRepo) ListByOrg(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) ([]*repods.DataSource, error)
- func (f *FakeDataSourceRepo) LockDataSourceForUpdate(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
- func (f *FakeDataSourceRepo) MarkTestFailure(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.DataSource, error)
- func (f *FakeDataSourceRepo) MarkTestSuccess(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.DataSource, error)
- func (f *FakeDataSourceRepo) Restore(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
- func (f *FakeDataSourceRepo) SetReadOnly(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) error
- func (f *FakeDataSourceRepo) Update(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.DataSource, error)
- func (f *FakeDataSourceRepo) UpdateCredentials(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.DataSource, error)
- type FakeEmailProducer
- func (f *FakeEmailProducer) EnqueueEmailVerification(ctx context.Context, tx postgres.DBTX, user *model.User, ...) (queue.QueuedJob, error)
- func (f *FakeEmailProducer) EnqueueMemberInvitation(ctx context.Context, tx postgres.DBTX, invitation model.MemberInvitationEmail, ...) (queue.QueuedJob, error)
- func (f *FakeEmailProducer) EnqueueMessage(ctx context.Context, tx postgres.DBTX, user *model.User, subject, body string) (queue.QueuedJob, error)
- func (f *FakeEmailProducer) EnqueueNotification(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) (queue.QueuedJob, error)
- func (f *FakeEmailProducer) EnqueuePasswordReset(ctx context.Context, tx postgres.DBTX, user *model.User, resetURL string, ...) (queue.QueuedJob, error)
- func (f *FakeEmailProducer) EnqueueSessionMFA(ctx context.Context, tx postgres.DBTX, user *model.User, code string) (queue.QueuedJob, error)
- type FakeEmailService
- func (f *FakeEmailService) EmailVerification(ctx context.Context, user *model.User, verificationLink string) error
- func (f *FakeEmailService) MemberInvitation(ctx context.Context, invitation model.MemberInvitationEmail, ...) error
- func (f *FakeEmailService) Message(ctx context.Context, user *model.User, subject, body string) error
- func (f *FakeEmailService) Notification(ctx context.Context, recipient model.NotificationEmailRecipient, ...) error
- func (f *FakeEmailService) PasswordReset(ctx context.Context, user *model.User, resetLink string) error
- func (f *FakeEmailService) SessionMFA(ctx context.Context, user *model.User, code string) error
- type FakeEncryptor
- func (f *FakeEncryptor) Decrypt(ciphertext []byte) ([]byte, error)
- func (f *FakeEncryptor) Encrypt(plaintext []byte) ([]byte, error)
- func (f *FakeEncryptor) Open(_ crypto.CredentialScope, ciphertext []byte) ([]byte, error)
- func (f *FakeEncryptor) Seal(_ crypto.CredentialScope, plaintext []byte) ([]byte, error)
- type FakeHasher
- type FakeMemberInvitationsRepo
- func (f *FakeMemberInvitationsRepo) Create(ctx context.Context, tx postgres.DBTX, params memberinvitations.CreateParams) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) ExpirePendingByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, expiredAt time.Time) ([]*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) Find(ctx context.Context, tx postgres.DBTX, orgSlug, invitationSlug slug.Slug) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) FindByTokenHash(ctx context.Context, tx postgres.DBTX, tokenHash string) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) FindPendingByEmail(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) ([]*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) ListPendingByEmail(ctx context.Context, tx postgres.DBTX, email string, asOf time.Time) ([]*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) MarkAccepted(ctx context.Context, tx postgres.DBTX, ...) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) MarkDeclined(ctx context.Context, tx postgres.DBTX, ...) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) MarkExpired(ctx context.Context, tx postgres.DBTX, ...) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) MarkRevoked(ctx context.Context, tx postgres.DBTX, ...) (*memberinvitations.Invitation, error)
- func (f *FakeMemberInvitationsRepo) RefreshToken(ctx context.Context, tx postgres.DBTX, ...) (*memberinvitations.Invitation, error)
- type FakeMembersRepo
- func (f *FakeMembersRepo) CountByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug) (int64, error)
- func (f *FakeMembersRepo) CountByRole(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) (int64, error)
- func (f *FakeMembersRepo) Create(ctx context.Context, tx postgres.DBTX, p *members.CreateParams) (*members.Member, error)
- func (f *FakeMembersRepo) Find(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) (*members.Member, error)
- func (f *FakeMembersRepo) FindByEmail(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (*members.Member, error)
- func (f *FakeMembersRepo) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) ([]*members.Member, error)
- func (f *FakeMembersRepo) Remove(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) error
- func (f *FakeMembersRepo) Update(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug, roleSlug slug.Slug) error
- type FakeOperationAdmission
- type FakeOrgsRepo
- func (f *FakeOrgsRepo) Create(ctx context.Context, tx postgres.DBTX, p *organizations.CreateParams) (*organizations.Organization, error)
- func (f *FakeOrgsRepo) Delete(ctx context.Context, tx postgres.DBTX, s slug.Slug) error
- func (f *FakeOrgsRepo) DeletionBlocked(ctx context.Context, tx postgres.DBTX, s slug.Slug) (bool, error)
- func (f *FakeOrgsRepo) FindBySlug(ctx context.Context, tx postgres.DBTX, s slug.Slug) (*organizations.Organization, error)
- func (f *FakeOrgsRepo) FindBySlugForUpdate(ctx context.Context, tx postgres.DBTX, s slug.Slug) (*organizations.Organization, error)
- func (f *FakeOrgsRepo) ListByUser(ctx context.Context, tx postgres.DBTX, userSlug slug.Slug, ...) ([]*organizations.OrganizationWithRole, error)
- func (f *FakeOrgsRepo) Update(ctx context.Context, tx postgres.DBTX, p *organizations.UpdateParams) error
- func (f *FakeOrgsRepo) UpdateSettings(ctx context.Context, tx postgres.DBTX, p *organizations.UpdateSettingsParams) error
- type FakePermissionsRepo
- func (f *FakePermissionsRepo) AddToRole(ctx context.Context, tx postgres.DBTX, p *permissions.AddToRoleParams) error
- func (f *FakePermissionsRepo) ClearRolePermissions(ctx context.Context, tx postgres.DBTX, ...) error
- func (f *FakePermissionsRepo) Create(ctx context.Context, tx postgres.DBTX, params *permissions.CreateParams) (*permissions.Permission, error)
- func (f *FakePermissionsRepo) FindOrCreate(ctx context.Context, tx postgres.DBTX, resources, actions []string) ([]*permissions.Permission, error)
- func (f *FakePermissionsRepo) ListAll(ctx context.Context, tx postgres.DBTX) ([]*permissions.Permission, error)
- func (f *FakePermissionsRepo) ListForRole(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) ([]*permissions.Permission, error)
- func (f *FakePermissionsRepo) RemoveFromRole(ctx context.Context, tx postgres.DBTX, p *permissions.RemoveFromRoleParams) error
- type FakeQueryExecutor
- type FakeQueryRepository
- func (f *FakeQueryRepository) Create(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*qrepo.Query, []*qrepo.QueryParameter, error)
- func (f *FakeQueryRepository) CreateExecution(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, ...) (*qrepo.QueryExecution, error)
- func (f *FakeQueryRepository) Delete(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
- func (f *FakeQueryRepository) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) (*qrepo.Query, []*qrepo.QueryParameter, error)
- func (f *FakeQueryRepository) FindLatestSuccessfulExecution(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug) (*qrepo.QueryExecutionIdentity, error)
- func (f *FakeQueryRepository) FindSnapshot(ctx context.Context, db postgres.DBTX, org, source, operation slug.Slug) (*qrepo.OperationSnapshot, error)
- func (f *FakeQueryRepository) GetExecution(ctx context.Context, tx postgres.DBTX, ...) (*qrepo.QueryExecution, error)
- func (f *FakeQueryRepository) ListByDataSource(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) ([]*qrepo.Query, error)
- func (f *FakeQueryRepository) ListExecutions(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, ...) ([]*qrepo.QueryExecution, error)
- func (f *FakeQueryRepository) Purge(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
- func (f *FakeQueryRepository) Restore(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug) error
- func (f *FakeQueryRepository) Update(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, ...) (*qrepo.Query, []*qrepo.QueryParameter, error)
- type FakeRolesRepo
- func (f *FakeRolesRepo) Create(ctx context.Context, tx postgres.DBTX, p *roles.CreateParams) (*roles.Role, error)
- func (f *FakeRolesRepo) Delete(ctx context.Context, tx postgres.DBTX, p *roles.DeleteParams) error
- func (f *FakeRolesRepo) EnsureDefault(ctx context.Context, tx postgres.DBTX, p *roles.CreateParams) (*roles.Role, error)
- func (f *FakeRolesRepo) FindBySlug(ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug) (*roles.Role, error)
- func (f *FakeRolesRepo) GetUserPermissionsInOrg(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) ([]*roles.UserPermission, error)
- func (f *FakeRolesRepo) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, ...) ([]*roles.Role, error)
- func (f *FakeRolesRepo) Restore(ctx context.Context, tx postgres.DBTX, p *roles.RestoreParams) error
- func (f *FakeRolesRepo) Update(ctx context.Context, tx postgres.DBTX, p *roles.UpdateParams) error
- type FakeRunSucceededNotifier
- type FakeSQLConnector
- func (f *FakeSQLConnector) Close() error
- func (f *FakeSQLConnector) Execute(ctx context.Context, queryData json.RawMessage, ...) (*result.ExecutionResult, error)
- func (f *FakeSQLConnector) GetCapabilities() sql.Capabilities
- func (f *FakeSQLConnector) IntrospectSchema(ctx context.Context) (*sql.Schema, error)
- func (f *FakeSQLConnector) TestConnection(ctx context.Context) error
- type FakeSchemaMetadataRepo
- func (f *FakeSchemaMetadataRepo) DeleteByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) error
- func (f *FakeSchemaMetadataRepo) FindByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaMetadata, error)
- func (f *FakeSchemaMetadataRepo) FindCurrentImportAttemptByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) FindImportStateByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) MarkImportFailedByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) MarkImportReadyByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) ResetImportByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) StartImportByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.SchemaImportState, error)
- func (f *FakeSchemaMetadataRepo) UpsertByDataSourceSlug(ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ...) (*repods.SchemaMetadata, error)
- type FakeSessionLocker
- type FakeTransactionManager
- type FakeUsersRepo
- func (f *FakeUsersRepo) ConsumeMFAChallenge(ctx context.Context, tx postgres.DBTX, id int) error
- func (f *FakeUsersRepo) CreateEmailVerificationToken(ctx context.Context, tx postgres.DBTX, ...) error
- func (f *FakeUsersRepo) CreateMFAChallenge(ctx context.Context, tx postgres.DBTX, userSlug slug.Slug, ...) error
- func (f *FakeUsersRepo) CreateOIDCUser(ctx context.Context, tx postgres.DBTX, p *users.CreateOIDCUserParams) (*users.UserPublic, error)
- func (f *FakeUsersRepo) CreatePasswordResetToken(ctx context.Context, tx postgres.DBTX, ...) error
- func (f *FakeUsersRepo) CreateUser(ctx context.Context, tx postgres.DBTX, p *users.CreateParams) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindByEmail(ctx context.Context, tx postgres.DBTX, email string) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindByEmailVerificationToken(ctx context.Context, tx postgres.DBTX, tokenHash string) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindByEmailWithPassword(ctx context.Context, tx postgres.DBTX, email string) (*users.UserWithPassword, error)
- func (f *FakeUsersRepo) FindByOIDCProvider(ctx context.Context, tx postgres.DBTX, provider, providerID string) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindByPasswordResetToken(ctx context.Context, tx postgres.DBTX, tokenHash string) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindBySlug(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*users.UserPublic, error)
- func (f *FakeUsersRepo) FindBySlugWithPassword(ctx context.Context, tx postgres.DBTX, slug slug.Slug) (*users.UserWithPassword, error)
- func (f *FakeUsersRepo) FindMFAChallengeByToken(ctx context.Context, tx postgres.DBTX, challengeTokenHash string) (*users.MFAChallenge, error)
- func (f *FakeUsersRepo) IncrementMFAChallengeAttempts(ctx context.Context, tx postgres.DBTX, id int) error
- func (f *FakeUsersRepo) IsSlugReserved(ctx context.Context, tx postgres.DBTX, s slug.Slug) (bool, error)
- func (f *FakeUsersRepo) MarkEmailAsVerified(ctx context.Context, tx postgres.DBTX, slug slug.Slug, verifiedAt time.Time) error
- func (f *FakeUsersRepo) UpdatePassword(ctx context.Context, tx postgres.DBTX, slug slug.Slug, hashedPassword string) error
- func (f *FakeUsersRepo) UpdateProfile(ctx context.Context, tx postgres.DBTX, params *users.UpdateProfileParams) error
- type ProofHTTPTransport
- type ProofNativeTransport
Constants ¶
This section is empty.
Variables ¶
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 ¶
StubUserPublic returns a minimal UserPublic for use in tests.
Types ¶
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 (*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 (*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) SetReadOnly ¶
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 (*FakeEmailProducer) EnqueueMemberInvitation ¶
func (*FakeEmailProducer) EnqueueMessage ¶
func (*FakeEmailProducer) EnqueueNotification ¶
func (*FakeEmailProducer) EnqueuePasswordReset ¶
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 (*FakeEmailService) MemberInvitation ¶
func (f *FakeEmailService) MemberInvitation( ctx context.Context, invitation model.MemberInvitationEmail, acceptanceLink string, ) error
func (*FakeEmailService) Notification ¶
func (f *FakeEmailService) Notification( ctx context.Context, recipient model.NotificationEmailRecipient, notification model.NotificationEmail, ) error
func (*FakeEmailService) PasswordReset ¶
func (*FakeEmailService) SessionMFA ¶
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) 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)
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 (f *FakeMemberInvitationsRepo) Create( ctx context.Context, tx postgres.DBTX, params memberinvitations.CreateParams, ) (*memberinvitations.Invitation, error)
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 (f *FakeMemberInvitationsRepo) MarkAccepted( ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkAcceptedParams, ) (*memberinvitations.Invitation, error)
func (*FakeMemberInvitationsRepo) MarkDeclined ¶
func (f *FakeMemberInvitationsRepo) MarkDeclined( ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkDeclinedParams, ) (*memberinvitations.Invitation, error)
func (*FakeMemberInvitationsRepo) MarkExpired ¶
func (f *FakeMemberInvitationsRepo) MarkExpired( ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkExpiredParams, ) (*memberinvitations.Invitation, error)
func (*FakeMemberInvitationsRepo) MarkRevoked ¶
func (f *FakeMemberInvitationsRepo) MarkRevoked( ctx context.Context, tx postgres.DBTX, params memberinvitations.MarkRevokedParams, ) (*memberinvitations.Invitation, error)
func (*FakeMemberInvitationsRepo) RefreshToken ¶
func (f *FakeMemberInvitationsRepo) RefreshToken( ctx context.Context, tx postgres.DBTX, params memberinvitations.RefreshTokenParams, ) (*memberinvitations.Invitation, error)
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 (*FakeMembersRepo) CountByRole ¶
func (*FakeMembersRepo) Create ¶
func (f *FakeMembersRepo) Create( ctx context.Context, tx postgres.DBTX, p *members.CreateParams, ) (*members.Member, error)
func (*FakeMembersRepo) FindByEmail ¶
func (*FakeMembersRepo) ListByOrganization ¶
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)
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 (f *FakeOrgsRepo) Create( ctx context.Context, tx postgres.DBTX, p *organizations.CreateParams, ) (*organizations.Organization, error)
func (*FakeOrgsRepo) DeletionBlocked ¶
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 (f *FakeOrgsRepo) Update( ctx context.Context, tx postgres.DBTX, p *organizations.UpdateParams, ) error
func (*FakeOrgsRepo) UpdateSettings ¶
func (f *FakeOrgsRepo) UpdateSettings( ctx context.Context, tx postgres.DBTX, p *organizations.UpdateSettingsParams, ) error
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 (f *FakePermissionsRepo) AddToRole( ctx context.Context, tx postgres.DBTX, p *permissions.AddToRoleParams, ) error
func (*FakePermissionsRepo) ClearRolePermissions ¶
func (f *FakePermissionsRepo) ClearRolePermissions( ctx context.Context, tx postgres.DBTX, p *permissions.ClearRolePermissionsParams, ) error
func (*FakePermissionsRepo) Create ¶
func (f *FakePermissionsRepo) Create( ctx context.Context, tx postgres.DBTX, params *permissions.CreateParams, ) (*permissions.Permission, error)
func (*FakePermissionsRepo) FindOrCreate ¶
func (f *FakePermissionsRepo) FindOrCreate( ctx context.Context, tx postgres.DBTX, resources, actions []string, ) ([]*permissions.Permission, error)
func (*FakePermissionsRepo) ListAll ¶
func (f *FakePermissionsRepo) ListAll( ctx context.Context, tx postgres.DBTX, ) ([]*permissions.Permission, error)
func (*FakePermissionsRepo) ListForRole ¶
func (f *FakePermissionsRepo) ListForRole( ctx context.Context, tx postgres.DBTX, orgSlug, roleSlug slug.Slug, ) ([]*permissions.Permission, error)
func (*FakePermissionsRepo) RemoveFromRole ¶
func (f *FakePermissionsRepo) RemoveFromRole( ctx context.Context, tx postgres.DBTX, p *permissions.RemoveFromRoleParams, ) error
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 ¶
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) FindBySlug ¶
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 (*FakeQueryRepository) ListExecutions ¶
func (f *FakeQueryRepository) ListExecutions( ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug, querySlug slug.Slug, req model.ListRequest, ) ([]*qrepo.QueryExecution, 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 (f *FakeRolesRepo) Delete(ctx context.Context, tx postgres.DBTX, p *roles.DeleteParams) error
func (*FakeRolesRepo) EnsureDefault ¶
func (f *FakeRolesRepo) EnsureDefault( ctx context.Context, tx postgres.DBTX, p *roles.CreateParams, ) (*roles.Role, error)
func (*FakeRolesRepo) FindBySlug ¶
func (*FakeRolesRepo) GetUserPermissionsInOrg ¶
func (f *FakeRolesRepo) GetUserPermissionsInOrg( ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug, ) ([]*roles.UserPermission, error)
func (*FakeRolesRepo) ListByOrganization ¶
func (*FakeRolesRepo) Restore ¶
func (f *FakeRolesRepo) Restore(ctx context.Context, tx postgres.DBTX, p *roles.RestoreParams) error
func (*FakeRolesRepo) Update ¶
func (f *FakeRolesRepo) Update(ctx context.Context, tx postgres.DBTX, p *roles.UpdateParams) error
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 ¶
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 (*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 (*FakeSchemaMetadataRepo) FindByDataSourceSlug ¶
func (f *FakeSchemaMetadataRepo) FindByDataSourceSlug( ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ) (*repods.SchemaMetadata, error)
func (*FakeSchemaMetadataRepo) FindCurrentImportAttemptByDataSourceSlug ¶
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 (*FakeSchemaMetadataRepo) ResetImportByDataSourceSlug ¶
func (f *FakeSchemaMetadataRepo) ResetImportByDataSourceSlug( ctx context.Context, tx postgres.DBTX, orgSlug, dsSlug slug.Slug, ) (*repods.SchemaImportState, error)
func (*FakeSchemaMetadataRepo) StartImportByDataSourceSlug ¶
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 FakeTransactionManager ¶
FakeTransactionManager is a test double for postgres.TransactionManager. It executes the callback directly without opening a real transaction.
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 (*FakeUsersRepo) CreateEmailVerificationToken ¶
func (f *FakeUsersRepo) CreateEmailVerificationToken( ctx context.Context, tx postgres.DBTX, params users.CreateEmailVerificationTokenParams, ) error
func (*FakeUsersRepo) CreateMFAChallenge ¶
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 (*FakeUsersRepo) IsSlugReserved ¶
func (*FakeUsersRepo) MarkEmailAsVerified ¶
func (*FakeUsersRepo) UpdatePassword ¶
func (*FakeUsersRepo) UpdateProfile ¶
func (f *FakeUsersRepo) UpdateProfile( ctx context.Context, tx postgres.DBTX, params *users.UpdateProfileParams, ) error
type ProofHTTPTransport ¶
ProofHTTPTransport admits only HTTP in HTTPS observer unit tests.
func (ProofHTTPTransport) BeginNative ¶
func (t ProofHTTPTransport) BeginNative(proofevidence.MetadataRoute) error
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 (*ProofNativeTransport) HTTPClient ¶
func (t *ProofNativeTransport) HTTPClient() *http.Client
Source Files
¶
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. |