mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Updated datastore mock.
This commit is contained in:
parent
b864130fe9
commit
e92b4628ff
1 changed files with 12 additions and 0 deletions
|
|
@ -435,6 +435,8 @@ type NewGlobalPolicyFunc func(ctx context.Context, authorID *uint, args fleet.Po
|
|||
|
||||
type PolicyFunc func(ctx context.Context, id uint) (*fleet.Policy, error)
|
||||
|
||||
type PolicyLiteFunc func(ctx context.Context, id uint) (*fleet.PolicyLite, error)
|
||||
|
||||
type SavePolicyFunc func(ctx context.Context, p *fleet.Policy, shouldRemoveAllPolicyMemberships bool, removePolicyStats bool) error
|
||||
|
||||
type ListGlobalPoliciesFunc func(ctx context.Context, opts fleet.ListOptions) ([]*fleet.Policy, error)
|
||||
|
|
@ -1544,6 +1546,9 @@ type DataStore struct {
|
|||
PolicyFunc PolicyFunc
|
||||
PolicyFuncInvoked bool
|
||||
|
||||
PolicyLiteFunc PolicyLiteFunc
|
||||
PolicyLiteFuncInvoked bool
|
||||
|
||||
SavePolicyFunc SavePolicyFunc
|
||||
SavePolicyFuncInvoked bool
|
||||
|
||||
|
|
@ -3729,6 +3734,13 @@ func (s *DataStore) Policy(ctx context.Context, id uint) (*fleet.Policy, error)
|
|||
return s.PolicyFunc(ctx, id)
|
||||
}
|
||||
|
||||
func (s *DataStore) PolicyLite(ctx context.Context, id uint) (*fleet.PolicyLite, error) {
|
||||
s.mu.Lock()
|
||||
s.PolicyLiteFuncInvoked = true
|
||||
s.mu.Unlock()
|
||||
return s.PolicyLiteFunc(ctx, id)
|
||||
}
|
||||
|
||||
func (s *DataStore) SavePolicy(ctx context.Context, p *fleet.Policy, shouldRemoveAllPolicyMemberships bool, removePolicyStats bool) error {
|
||||
s.mu.Lock()
|
||||
s.SavePolicyFuncInvoked = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue