fakes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fakes provides in-memory implementations of the domain interfaces for tests. Each method calls its function field when set and otherwise returns a harmless default. Calls are recorded and safe for concurrent use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHub

type GitHub struct {
	CheckPRComplianceFn  func(ctx context.Context, owner, repo string, prNumber int) (*domain.PRComplianceResult, error)
	ResolveTeamFn        func(ctx context.Context, name, privacy string, create bool) (string, error)
	SyncTeamMembersFn    func(ctx context.Context, teamSlug string, desired []string, threshold float64) (*domain.TeamSyncResult, error)
	GetTeamMembersFn     func(ctx context.Context, teamSlug string) ([]string, error)
	ListOrgMembersFn     func(ctx context.Context) ([]string, error)
	GetAppSlugFn         func(ctx context.Context) (string, error)
	ListSecurityAlertsFn func(ctx context.Context, minAgeDays int, minSeverity string) (*domain.SecurityAlertsReport, error)
	// contains filtered or unexported fields
}

GitHub is a fake domain.GitHubClient.

func (*GitHub) CheckPRCompliance

func (f *GitHub) CheckPRCompliance(ctx context.Context, owner, repo string, prNumber int) (*domain.PRComplianceResult, error)

func (*GitHub) Count

func (c *GitHub) Count(name string) int

Count returns how many times the named method was called.

func (*GitHub) GetAppSlug

func (f *GitHub) GetAppSlug(ctx context.Context) (string, error)

func (*GitHub) GetTeamMembers

func (f *GitHub) GetTeamMembers(ctx context.Context, teamSlug string) ([]string, error)

func (*GitHub) ListOrgMembers

func (f *GitHub) ListOrgMembers(ctx context.Context) ([]string, error)

func (*GitHub) ListSecurityAlerts

func (f *GitHub) ListSecurityAlerts(ctx context.Context, minAgeDays int, minSeverity string) (*domain.SecurityAlertsReport, error)

func (*GitHub) ResolveTeam

func (f *GitHub) ResolveTeam(ctx context.Context, name, privacy string, create bool) (string, error)

func (*GitHub) SyncTeamMembers

func (f *GitHub) SyncTeamMembers(ctx context.Context, teamSlug string, desired []string, threshold float64) (*domain.TeamSyncResult, error)

type Notifier

type Notifier struct {
	Err error

	PRBypasses     []*domain.PRComplianceResult
	OktaSyncs      [][]*domain.SyncReport
	OrphanedUsers  []*domain.OrphanedUsersReport
	SecurityAlerts []*domain.SecurityAlertsReport
	// contains filtered or unexported fields
}

Notifier is a fake domain.Notifier that keeps what it was asked to send.

func (*Notifier) Count

func (c *Notifier) Count(name string) int

Count returns how many times the named method was called.

func (*Notifier) NotifyOktaSync

func (f *Notifier) NotifyOktaSync(_ context.Context, reports []*domain.SyncReport, _ string) error

func (*Notifier) NotifyOrphanedUsers

func (f *Notifier) NotifyOrphanedUsers(_ context.Context, report *domain.OrphanedUsersReport) error

func (*Notifier) NotifyPRBypass

func (f *Notifier) NotifyPRBypass(_ context.Context, result *domain.PRComplianceResult, _ string) error

func (*Notifier) NotifySecurityAlerts

func (f *Notifier) NotifySecurityAlerts(_ context.Context, report *domain.SecurityAlertsReport, _ string) error

type Okta

type Okta struct {
	GetGroupsByPatternFn func(ctx context.Context, pattern string) ([]*domain.GroupInfo, error)
	GetGroupInfoFn       func(ctx context.Context, name string) (*domain.GroupInfo, error)
	// contains filtered or unexported fields
}

Okta is a fake domain.OktaClient.

func (*Okta) Count

func (c *Okta) Count(name string) int

Count returns how many times the named method was called.

func (*Okta) GetGroupInfo

func (f *Okta) GetGroupInfo(ctx context.Context, name string) (*domain.GroupInfo, error)

func (*Okta) GetGroupsByPattern

func (f *Okta) GetGroupsByPattern(ctx context.Context, pattern string) ([]*domain.GroupInfo, error)

Jump to

Keyboard shortcuts

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