@@ -3,20 +3,22 @@ package webhook_creator
33import (
44 context2 "context"
55 "errors"
6+ "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
67 "github.com/quickube/piper/pkg/git_provider"
78 "golang.org/x/net/context"
89 "net/http"
910)
1011
1112type MockGitProviderClient struct {
12- ListFilesFunc func (ctx context.Context , repo string , branch string , path string ) ([]string , error )
13- GetFileFunc func (ctx context.Context , repo string , branch string , path string ) (* git_provider.CommitFile , error )
14- GetFilesFunc func (ctx context.Context , repo string , branch string , paths []string ) ([]* git_provider.CommitFile , error )
15- SetWebhookFunc func (ctx context.Context , repo * string ) (* git_provider.HookWithStatus , error )
16- UnsetWebhookFunc func (ctx context.Context , hook * git_provider.HookWithStatus ) error
17- HandlePayloadFunc func (request * http.Request , secret []byte ) (* git_provider.WebhookPayload , error )
18- SetStatusFunc func (ctx context.Context , repo * string , commit * string , linkURL * string , status * string , message * string ) error
19- PingHookFunc func (ctx context.Context , hook * git_provider.HookWithStatus ) error
13+ ListFilesFunc func (ctx context.Context , repo string , branch string , path string ) ([]string , error )
14+ GetFileFunc func (ctx context.Context , repo string , branch string , path string ) (* git_provider.CommitFile , error )
15+ GetFilesFunc func (ctx context.Context , repo string , branch string , paths []string ) ([]* git_provider.CommitFile , error )
16+ SetWebhookFunc func (ctx context.Context , repo * string ) (* git_provider.HookWithStatus , error )
17+ UnsetWebhookFunc func (ctx context.Context , hook * git_provider.HookWithStatus ) error
18+ HandlePayloadFunc func (request * http.Request , secret []byte ) (* git_provider.WebhookPayload , error )
19+ SetStatusFunc func (ctx context.Context , repo * string , commit * string , linkURL * string , status * string , message * string ) error
20+ PingHookFunc func (ctx context.Context , hook * git_provider.HookWithStatus ) error
21+ GetCorrelatingEventFunc func (ctx context.Context , workflowEvent * v1alpha1.WorkflowPhase ) (string , error )
2022}
2123
2224func (m * MockGitProviderClient ) ListFiles (ctx context2.Context , repo string , branch string , path string ) ([]string , error ) {
@@ -67,6 +69,12 @@ func (m *MockGitProviderClient) SetStatus(ctx context2.Context, repo *string, co
6769 }
6870 return errors .New ("unimplemented" )
6971}
72+ func (m * MockGitProviderClient ) GetCorrelatingEvent (ctx context.Context , workflowEvent * v1alpha1.WorkflowPhase ) (string , error ) {
73+ if m .GetCorrelatingEventFunc != nil {
74+ return m .GetCorrelatingEventFunc (ctx , workflowEvent )
75+ }
76+ return "" , errors .New ("unimplemented" )
77+ }
7078
7179func (m * MockGitProviderClient ) PingHook (ctx context2.Context , hook * git_provider.HookWithStatus ) error {
7280 if m .PingHookFunc != nil {
0 commit comments