From d7d6d1e31a3b58eb2a6033ab4d3d534b09a2491a Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Sun, 6 Apr 2025 16:20:07 +0000 Subject: [PATCH] Add mocks Signed-off-by: Gabriel Adrian Samfira --- runner/common/mocks/GithubClient.go | 40 +++++++++++++++++++ runner/common/mocks/GithubEntityOperations.go | 40 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/runner/common/mocks/GithubClient.go b/runner/common/mocks/GithubClient.go index c59c631b..4ca73de3 100644 --- a/runner/common/mocks/GithubClient.go +++ b/runner/common/mocks/GithubClient.go @@ -9,6 +9,8 @@ import ( mock "github.com/stretchr/testify/mock" params "github.com/cloudbase/garm/params" + + url "net/url" ) // GithubClient is an autogenerated mock type for the GithubClient type @@ -115,6 +117,24 @@ func (_m *GithubClient) DeleteEntityHook(ctx context.Context, id int64) (*github return r0, r1 } +// GetEntity provides a mock function with given fields: +func (_m *GithubClient) GetEntity() params.GithubEntity { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetEntity") + } + + var r0 params.GithubEntity + if rf, ok := ret.Get(0).(func() params.GithubEntity); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(params.GithubEntity) + } + + return r0 +} + // GetEntityHook provides a mock function with given fields: ctx, id func (_m *GithubClient) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) { ret := _m.Called(ctx, id) @@ -223,6 +243,26 @@ func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, re return r0, r1, r2 } +// GithubBaseURL provides a mock function with given fields: +func (_m *GithubClient) GithubBaseURL() *url.URL { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GithubBaseURL") + } + + var r0 *url.URL + if rf, ok := ret.Get(0).(func() *url.URL); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*url.URL) + } + } + + return r0 +} + // ListEntityHooks provides a mock function with given fields: ctx, opts func (_m *GithubClient) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, opts) diff --git a/runner/common/mocks/GithubEntityOperations.go b/runner/common/mocks/GithubEntityOperations.go index 488387f6..599a04a0 100644 --- a/runner/common/mocks/GithubEntityOperations.go +++ b/runner/common/mocks/GithubEntityOperations.go @@ -9,6 +9,8 @@ import ( mock "github.com/stretchr/testify/mock" params "github.com/cloudbase/garm/params" + + url "net/url" ) // GithubEntityOperations is an autogenerated mock type for the GithubEntityOperations type @@ -115,6 +117,24 @@ func (_m *GithubEntityOperations) DeleteEntityHook(ctx context.Context, id int64 return r0, r1 } +// GetEntity provides a mock function with given fields: +func (_m *GithubEntityOperations) GetEntity() params.GithubEntity { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetEntity") + } + + var r0 params.GithubEntity + if rf, ok := ret.Get(0).(func() params.GithubEntity); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(params.GithubEntity) + } + + return r0 +} + // GetEntityHook provides a mock function with given fields: ctx, id func (_m *GithubEntityOperations) GetEntityHook(ctx context.Context, id int64) (*github.Hook, error) { ret := _m.Called(ctx, id) @@ -184,6 +204,26 @@ func (_m *GithubEntityOperations) GetEntityJITConfig(ctx context.Context, instan return r0, r1, r2 } +// GithubBaseURL provides a mock function with given fields: +func (_m *GithubEntityOperations) GithubBaseURL() *url.URL { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GithubBaseURL") + } + + var r0 *url.URL + if rf, ok := ret.Get(0).(func() *url.URL); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*url.URL) + } + } + + return r0 +} + // ListEntityHooks provides a mock function with given fields: ctx, opts func (_m *GithubEntityOperations) ListEntityHooks(ctx context.Context, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, opts)