-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
onboarding_service.go
50 lines (41 loc) · 1.72 KB
/
onboarding_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package mock
import (
"context"
platform "github.com/influxdata/influxdb/v2"
)
var _ platform.OnboardingService = (*OnboardingService)(nil)
// OnboardingService is a mock implementation of platform.OnboardingService.
type OnboardingService struct {
PasswordsService
BucketService
OrganizationService
UserService
AuthorizationService
IsOnboardingFn func(context.Context) (bool, error)
OnboardInitialUserFn func(context.Context, *platform.OnboardingRequest) (*platform.OnboardingResults, error)
OnboardUserFn func(context.Context, *platform.OnboardingRequest) (*platform.OnboardingResults, error)
}
// NewOnboardingService returns a mock of OnboardingService where its methods will return zero values.
func NewOnboardingService() *OnboardingService {
return &OnboardingService{
IsOnboardingFn: func(context.Context) (bool, error) { return false, nil },
OnboardInitialUserFn: func(context.Context, *platform.OnboardingRequest) (*platform.OnboardingResults, error) {
return nil, nil
},
OnboardUserFn: func(context.Context, *platform.OnboardingRequest) (*platform.OnboardingResults, error) {
return nil, nil
},
}
}
// IsOnboarding determine if onboarding request is allowed.
func (s *OnboardingService) IsOnboarding(ctx context.Context) (bool, error) {
return s.IsOnboardingFn(ctx)
}
// OnboardInitialUser OnboardingResults.
func (s *OnboardingService) OnboardInitialUser(ctx context.Context, req *platform.OnboardingRequest) (*platform.OnboardingResults, error) {
return s.OnboardInitialUserFn(ctx, req)
}
// OnboardUser OnboardingResults.
func (s *OnboardingService) OnboardUser(ctx context.Context, req *platform.OnboardingRequest) (*platform.OnboardingResults, error) {
return s.OnboardUserFn(ctx, req)
}