From 1f80aa9f39e33b45f85a4f93bf0a85f139f08bb4 Mon Sep 17 00:00:00 2001 From: roi-codefresh Date: Tue, 29 Mar 2022 15:09:49 +0300 Subject: [PATCH] Add security.md (#256) * added security scan to ci and release pipelines * added SECURITY.md file * moved from mockery to gomock library --- .golangci.yaml | 6 +- Makefile | 25 +- SECURITY.md | 48 + build/ci.yml | 19 + build/release.yml | 23 +- cmd/commands/app_test.go | 276 +- cmd/commands/common_test.go | 23 +- cmd/commands/project_test.go | 116 +- cmd/commands/repo_test.go | 176 +- go.mod | 16 +- go.sum | 35 +- pkg/application/application.go | 2 +- pkg/application/application_test.go | 24 +- pkg/application/mocks/application.go | 72 +- pkg/fs/fs.go | 2 +- pkg/fs/fs_test.go | 82 +- pkg/fs/mocks/file.go | 164 - pkg/fs/mocks/fs.go | 670 ++-- pkg/git/ado/mocks/ado.go | 88 + pkg/git/ado/mocks/ado_client.go | 38 - pkg/git/ado/mocks/ado_url.go | 24 - pkg/git/gitea/mocks/client.go | 152 +- pkg/git/github/mocks/organizations.go | 1200 ------- pkg/git/github/mocks/repos.go | 2274 +++++++++++++ pkg/git/github/mocks/repositories.go | 4326 ------------------------- pkg/git/github/mocks/users.go | 1530 ++++----- pkg/git/gitlab/mocks/client.go | 97 + pkg/git/gitlab/mocks/gitlab_client.go | 129 - pkg/git/gogit/mocks/repository.go | 1398 ++++---- pkg/git/gogit/mocks/worktree.go | 495 ++- pkg/git/mocks/provider.go | 63 +- pkg/git/mocks/repository.go | 85 +- pkg/git/provider.go | 2 +- pkg/git/provider_ado.go | 8 +- pkg/git/provider_ado_test.go | 62 +- pkg/git/provider_gitea.go | 2 +- pkg/git/provider_gitea_test.go | 68 +- pkg/git/provider_github.go | 6 +- pkg/git/provider_github_test.go | 121 +- pkg/git/provider_gitlab.go | 2 +- pkg/git/provider_gitlab_test.go | 115 +- pkg/git/repository.go | 5 +- pkg/git/repository_test.go | 709 ++-- pkg/kube/kube.go | 2 +- pkg/kube/mocks/kube.go | 181 +- 45 files changed, 5548 insertions(+), 9413 deletions(-) create mode 100644 SECURITY.md delete mode 100644 pkg/fs/mocks/file.go create mode 100644 pkg/git/ado/mocks/ado.go delete mode 100644 pkg/git/ado/mocks/ado_client.go delete mode 100644 pkg/git/ado/mocks/ado_url.go delete mode 100644 pkg/git/github/mocks/organizations.go create mode 100644 pkg/git/github/mocks/repos.go delete mode 100644 pkg/git/github/mocks/repositories.go create mode 100644 pkg/git/gitlab/mocks/client.go delete mode 100644 pkg/git/gitlab/mocks/gitlab_client.go diff --git a/.golangci.yaml b/.golangci.yaml index 56e80e57..3f75b510 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -3,6 +3,10 @@ # options for analysis running run: + # https://github.com/golangci/golangci-lint/issues/2649 + # enable go 1.17 linting, will not allow generics + go: "1.17" + # default concurrency is a available CPU number concurrency: 4 @@ -30,4 +34,4 @@ linters-settings: gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) - min-complexity: 18 \ No newline at end of file + min-complexity: 18 diff --git a/Makefile b/Makefile index 23a579a4..37a588d9 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,7 @@ $(OUT_DIR)/$(CLI_NAME).image: $(CLI_SRCS) .PHONY: lint lint: $(GOBIN)/golangci-lint tidy + @golangci-lint version @echo linting go code... @golangci-lint run --fix --timeout 6m @@ -110,7 +111,7 @@ test: ./hack/test.sh .PHONY: codegen -codegen: $(GOBIN)/mockery +codegen: $(GOBIN)/mockgen rm -f docs/commands/* go generate ./... @@ -149,25 +150,11 @@ tidy: check-worktree: @./hack/check_worktree.sh -$(GOBIN)/mockery: - @mkdir dist || true - @echo installing: mockery - @curl -L -o dist/mockery.tar.gz -- https://github.com/vektra/mockery/releases/download/v2.8.0/mockery_2.8.0_$(shell uname -s)_$(shell uname -m).tar.gz - @tar zxvf dist/mockery.tar.gz mockery - @rm dist/mockery.tar.gz - @chmod +x mockery - @mkdir -p $(GOBIN) - @mv mockery $(GOBIN)/mockery - @mockery --version +$(GOBIN)/mockgen: + @go install github.com/golang/mock/mockgen@v1.6.0 + @mockgen -version $(GOBIN)/golangci-lint: @mkdir dist || true @echo installing: golangci-lint - @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.36.0 - -$(GOBIN)/interfacer: cwd=$(shell pwd) -$(GOBIN)/interfacer: - @cd /tmp - @echo installing: interfacer - @GO111MODULE=on go get -v github.com/rjeczalik/interfaces/cmd/interfacer@v0.1.1 - @cd ${cwd} + @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.45.2 diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..ecea6264 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,48 @@ +# Security Policy for Argo-CD Autopilot + +## Preface + +Argo-CD Autopilot is a tool that helps users to get an opinionated gitops +repository and bootstrapped Argo-CD installation. To achieve its goals +Argo-CD Autopilot requires access to the Kubernetes cluster you want to +install Argo-CD on and optionally to other Kubernetes clusters you want +to connect to the Argo-CD instance as target clusters for deployments. + +Because Argo-CD Autopilot is a gitops tool it also requires access to +your git repositories. Currently it requires pull and push access to +your gitops repo (permission to create repositories is also required +if you want to also create the repository as part of the bootstrapping +process). Though, there are [plans](https://github.com/argoproj-labs/argocd-autopilot/issues/51) +to have an optional local mode of operation where the user can +tell Argo-CD Autopilot to make changes to a local copy of the repo, +making the git repository access completely optional. + +## Security Scans + +We use the following static code analysis tools: + +* golangci-lint and tslint for compile time linting +* snyk.io - for image scanning + +These are run on each pull request and before each release. + +Additionally, Dependabot is configured to scan and report new security +vulnerabilities in our dependancy tree on a daily basis. + +## Reporting a Vulnerability + +If you find a security related bug in Argo-CD Autopilot, we kindly ask you +for responsible disclosure and for giving us appropriate time to react, +analyze and develop a fix to mitigate the found security vulnerability. + +Please report vulnerabilities by e-mail to the following address: + +* argocd-autopilot@codefresh.io + +All vulnerabilities and associated information will be treated with full confidentiality. + +## Public Disclosure + +Security vulnerabilities will be disclosed via release notes and using the +[GitHub Security Advisories](https://github.com/argoproj-labs/argocd-autopilot/security/advisories) +feature to keep our community well informed, and will credit you for your findings (unless you prefer to stay anonymous, of course). diff --git a/build/ci.yml b/build/ci.yml index 456a2802..9676305d 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -109,6 +109,25 @@ steps: on: - success + scan-image: + stage: Build + title: scan docker image + image: quay.io/codefresh/snyk-cli:latest + shell: bash + environment: + - SNYK_TOKEN=${{SNYK_TOKEN}} + - LOCAL_IMAGE_REF=${{IMAGE_NAME}}:${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + commands: + - | + snyk test --severity-threshold=${{SNYK_SEVERITY_THRESHOLD}} || fail=1 + snyk container test --severity-threshold=${{SNYK_SEVERITY_THRESHOLD}} --file=Dockerfile ${LOCAL_IMAGE_REF} + if [ "$fail" == "1" ]; then exit 1; fi + when: + steps: + - name: build + on: + - success + push_dev: stage: Push Dev title: push with dev tags diff --git a/build/release.yml b/build/release.yml index 12d87875..effd64bb 100644 --- a/build/release.yml +++ b/build/release.yml @@ -97,7 +97,7 @@ steps: - name: test on: - success - + build: stage: Build title: build docker image @@ -112,6 +112,25 @@ steps: on: - success + scan-image: + stage: Build + title: scan docker image + image: quay.io/codefresh/snyk-cli:latest + shell: bash + environment: + - SNYK_TOKEN=${{SNYK_TOKEN}} + - LOCAL_IMAGE_REF=${{IMAGE_NAME}}:${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + commands: + - | + snyk test --severity-threshold=${{SNYK_SEVERITY_THRESHOLD}} || fail=1 + snyk container test --severity-threshold=${{SNYK_SEVERITY_THRESHOLD}} --file=Dockerfile ${LOCAL_IMAGE_REF} + if [ "$fail" == "1" ]; then exit 1; fi + when: + steps: + - name: build + on: + - success + build_binaries: <<: *deps stage: Build @@ -153,7 +172,7 @@ steps: - name: lint on: - success - + create_release: <<: *deps stage: Release diff --git a/cmd/commands/app_test.go b/cmd/commands/app_test.go index 91bedcfd..eb8f336e 100644 --- a/cmd/commands/app_test.go +++ b/cmd/commands/app_test.go @@ -17,13 +17,13 @@ import ( gitmocks "github.com/argoproj-labs/argocd-autopilot/pkg/git/mocks" kubemocks "github.com/argoproj-labs/argocd-autopilot/pkg/kube/mocks" "github.com/argoproj-labs/argocd-autopilot/pkg/store" - argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" + "github.com/golang/mock/gomock" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/go-git/go-billy/v5/memfs" billyUtils "github.com/go-git/go-billy/v5/util" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestRunAppCreate(t *testing.T) { @@ -34,22 +34,21 @@ func TestRunAppCreate(t *testing.T) { setAppOptsDefaultsErr error parseAppErr error createFilesErr error - beforeFn func(f *kubemocks.Factory) - prepareRepo func() (git.Repository, fs.FS, error) + beforeFn func(f *kubemocks.MockFactory) + prepareRepo func(*testing.T) (git.Repository, fs.FS, error) getRepo func(*testing.T, *git.CloneOptions) (git.Repository, fs.FS, error) getInstallationNamespace func(repofs fs.FS) (string, error) - assertFn func(*testing.T, git.Repository, git.Repository) }{ "Should fail when clone fails": { wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, fmt.Errorf("some error") }, }, "Should fail if srcClone fails": { appsRepo: "https://github.com/owner/other_name", wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, nil }, getRepo: func(_ *testing.T, _ *git.CloneOptions) (git.Repository, fs.FS, error) { @@ -59,7 +58,7 @@ func TestRunAppCreate(t *testing.T) { "Should use cloneOpts password for srcCloneOpts, if required": { appsRepo: "https://github.com/owner/other_name/path?ref=branch", wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, nil }, getRepo: func(t *testing.T, opts *git.CloneOptions) (git.Repository, fs.FS, error) { @@ -72,14 +71,14 @@ func TestRunAppCreate(t *testing.T) { }, "Should fail if setAppOptsDefaults fails": { wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, nil }, setAppOptsDefaultsErr: fmt.Errorf("some error"), }, "Should fail if app parse fails": { wantErr: "failed to parse application from flags: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, nil }, parseAppErr: errors.New("some error"), @@ -87,62 +86,68 @@ func TestRunAppCreate(t *testing.T) { "Should fail if app already exist in project": { wantErr: fmt.Errorf("application 'app' already exists in project 'project': %w", application.ErrAppAlreadyInstalledOnProject).Error(), createFilesErr: application.ErrAppAlreadyInstalledOnProject, - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) return mockRepo, fs.Create(memfs), nil }, }, "Should fail if file creation fails": { wantErr: "some error", createFilesErr: errors.New("some error"), - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) return mockRepo, fs.Create(memfs), nil }, }, "Should fail if commiting to appsRepo fails": { appsRepo: "https://github.com/owner/other_name", wantErr: "failed to push to apps repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) return mockRepo, fs.Create(memfs), nil }, getRepo: func(_ *testing.T, _ *git.CloneOptions) (git.Repository, fs.FS, error) { - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("", fmt.Errorf("some error")) + }). + Times(1). + Return("", fmt.Errorf("some error")) return mockRepo, fs.Create(memfs.New()), nil }, }, "Should fail if commiting to gitops repo fails": { wantErr: "failed to push to gitops repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("", fmt.Errorf("some error")) + }). + Times(1). + Return("", fmt.Errorf("some error")) return mockRepo, fs.Create(memfs), nil }, }, "Should fail if getInstallationNamespace fails": { timeout: 1, wantErr: "failed to get application namespace: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, getInstallationNamespace: func(repofs fs.FS) (string, error) { @@ -152,16 +157,20 @@ func TestRunAppCreate(t *testing.T) { "Should fail if waiting fails": { timeout: 1, wantErr: "failed waiting for application to sync: some error", - beforeFn: func(f *kubemocks.Factory) { - f.On("Wait", mock.Anything, mock.Anything).Return(errors.New("some error")) + beforeFn: func(f *kubemocks.MockFactory) { + f.EXPECT().Wait(gomock.Any(), gomock.Any()). + Times(1). + Return(errors.New("some error")) }, - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, getInstallationNamespace: func(repofs fs.FS) (string, error) { @@ -171,64 +180,62 @@ func TestRunAppCreate(t *testing.T) { "Should Persist to both repos, if required": { appsRepo: "https://github.com/owner/other_name", wantErr: "failed to push to gitops repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, - getRepo: func(_ *testing.T, _ *git.CloneOptions) (git.Repository, fs.FS, error) { - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + getRepo: func(t *testing.T, _ *git.CloneOptions) (git.Repository, fs.FS, error) { + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs.New()), nil }, - assertFn: func(t *testing.T, gitopsRepo git.Repository, appsRepo git.Repository) { - gitopsRepo.(*gitmocks.Repository).AssertExpectations(t) - appsRepo.(*gitmocks.Repository).AssertExpectations(t) - }, }, "Should Persist to a single repo, if required": { wantErr: "failed to push to gitops repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, - assertFn: func(t *testing.T, gitopsRepo git.Repository, appsRepo git.Repository) { - assert.Nil(t, appsRepo) - gitopsRepo.(*gitmocks.Repository).AssertExpectations(t) - }, }, "Should wait succesfully and complete": { timeout: 1, - beforeFn: func(f *kubemocks.Factory) { - f.On("Wait", mock.Anything, mock.Anything).Return(nil) + beforeFn: func(f *kubemocks.MockFactory) { + f.EXPECT().Wait(gomock.Any(), gomock.Any()). + Times(1). + Return(nil) }, - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "installed app 'app' on project 'project' installation-path: '/'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, getInstallationNamespace: func(repofs fs.FS) (string, error) { return "namespace", nil }, - assertFn: func(t *testing.T, gitopsRepo git.Repository, appsRepo git.Repository) { - assert.Nil(t, appsRepo) - gitopsRepo.(*gitmocks.Repository).AssertExpectations(t) - }, }, } origPrepareRepo, origGetRepo, origSetAppOptsDefault, origAppParse, origGetInstallationNamespace := prepareRepo, getRepo, setAppOptsDefaults, parseApp, getInstallationNamespace @@ -246,7 +253,8 @@ func TestRunAppCreate(t *testing.T) { appsRepo git.Repository ) - f := &kubemocks.Factory{} + ctrl := gomock.NewController(t) + f := kubemocks.NewMockFactory(ctrl) if tt.beforeFn != nil { tt.beforeFn(f) } @@ -255,7 +263,7 @@ func TestRunAppCreate(t *testing.T) { repofs fs.FS err error ) - gitopsRepo, repofs, err = tt.prepareRepo() + gitopsRepo, repofs, err = tt.prepareRepo(t) return gitopsRepo, repofs, err } getRepo = func(_ context.Context, cloneOpts *git.CloneOptions) (git.Repository, fs.FS, error) { @@ -274,9 +282,9 @@ func TestRunAppCreate(t *testing.T) { return nil, tt.parseAppErr } - app := &appmocks.Application{} - app.On("Name").Return("app") - app.On("CreateFiles", mock.Anything, mock.Anything, "project").Return(tt.createFilesErr) + app := appmocks.NewMockApplication(ctrl) + app.EXPECT().Name().Return("app").AnyTimes() + app.EXPECT().CreateFiles(gomock.Any(), gomock.Any(), "project").Return(tt.createFilesErr).AnyTimes() return app, nil } getInstallationNamespace = tt.getInstallationNamespace @@ -311,10 +319,6 @@ func TestRunAppCreate(t *testing.T) { return } - - if tt.assertFn != nil { - tt.assertFn(t, gitopsRepo, appsRepo) - } }) } } @@ -341,8 +345,8 @@ func Test_getCommitMsg(t *testing.T) { } for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - m := &fsmocks.FS{} - m.On("Root").Return(tt.root) + m := fsmocks.NewMockFS(gomock.NewController(t)) + m.EXPECT().Root().Return(tt.root).AnyTimes() opts := &AppCreateOptions{ ProjectName: tt.projectName, AppOpts: &application.CreateOptions{ @@ -421,19 +425,19 @@ func TestRunAppDelete(t *testing.T) { projectName string global bool wantErr string - prepareRepo func() (git.Repository, fs.FS, error) + prepareRepo func(*testing.T) (git.Repository, fs.FS, error) assertFn func(t *testing.T, repo git.Repository, repofs fs.FS) }{ "Should fail when clone fails": { wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { return nil, nil, fmt.Errorf("some error") }, }, "Should fail when app does not exist": { appName: "app", wantErr: "application 'app' not found", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { return nil, fs.Create(memfs.New()), nil }, }, @@ -441,32 +445,35 @@ func TestRunAppDelete(t *testing.T) { appName: "app", global: true, wantErr: fmt.Sprintf("failed to delete directory '%s': some error", filepath.Join(store.Default.AppsDir, "app")), - prepareRepo: func() (git.Repository, fs.FS, error) { - mfs := &fsmocks.FS{} - mfs.On("Join", mock.AnythingOfType("string"), mock.AnythingOfType("string")).Return(func(elem ...string) string { - return strings.Join(elem, "/") - }) + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { + mfs := fsmocks.NewMockFS(gomock.NewController(t)) path := filepath.Join(store.Default.AppsDir, "app") - mfs.On("ExistsOrDie", path).Return(true) - mfs.On("Remove", path).Return(fmt.Errorf("some error")) - mfs.On("Stat", path).Return(nil, fmt.Errorf("some error")) + mfs.EXPECT().Join(gomock.Any()). + Times(1). + DoAndReturn(func(elem ...string) string { + return strings.Join(elem, "/") + }) + mfs.EXPECT().ExistsOrDie(path).Return(true) + mfs.EXPECT().Remove(path).Return(fmt.Errorf("some error")) + mfs.EXPECT().Stat(path).Return(nil, fmt.Errorf("some error")) return nil, mfs, nil }, }, "Should remove entire app directory when global flag is set": { appName: "app", global: true, - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app"))) }, }, @@ -474,7 +481,7 @@ func TestRunAppDelete(t *testing.T) { appName: "app", projectName: "project", wantErr: "application 'app' not found in project 'project'", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project2"), 0666) return nil, fs.Create(memfs), nil @@ -484,33 +491,44 @@ func TestRunAppDelete(t *testing.T) { appName: "app", projectName: "project", wantErr: fmt.Sprintf("failed to read overlays directory '%s': some error", filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir)), - prepareRepo: func() (git.Repository, fs.FS, error) { - mfs := &fsmocks.FS{} - mfs.On("Join", mock.AnythingOfType("string"), mock.AnythingOfType("string")).Return(func(elem ...string) string { - return strings.Join(elem, "/") - }) - mfs.On("ExistsOrDie", filepath.Join(store.Default.AppsDir, "app")).Return(true) - mfs.On("ExistsOrDie", filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir)).Return(true) - mfs.On("ExistsOrDie", filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project")).Return(true) - mfs.On("ReadDir", filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir)).Return(nil, fmt.Errorf("some error")) + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { + mfs := fsmocks.NewMockFS(gomock.NewController(t)) + mfs.EXPECT().Join(gomock.Any()). + Times(3). + DoAndReturn(func(elem ...string) string { + return strings.Join(elem, "/") + }) + mfs.EXPECT().ExistsOrDie(filepath.Join(store.Default.AppsDir, "app")). + Times(1). + Return(true) + mfs.EXPECT().ExistsOrDie(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir)). + Times(1). + Return(true) + mfs.EXPECT().ExistsOrDie(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project")). + Times(1). + Return(true) + mfs.EXPECT().ReadDir(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir)). + Times(1). + Return(nil, fmt.Errorf("some error")) return nil, mfs, nil }, }, "Should delete only overlay directory of a kustApp, if there are more overlays": { appName: "app", projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project2"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app' from project 'project'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.True(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir))) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"))) }, @@ -518,35 +536,37 @@ func TestRunAppDelete(t *testing.T) { "Should delete entire app directory of a kustApp, if there are no more overlays": { appName: "app", projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app"))) }, }, "Should delete only project directory of a dirApp, if there are more projects": { appName: "app", projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", "project"), 0666) _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", "project2"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app' from project 'project'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.True(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app"))) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app", "project"))) }, @@ -554,17 +574,18 @@ func TestRunAppDelete(t *testing.T) { "Should delete entire app directory of a dirApp": { appName: "app", projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app'", - }).Return("revision", nil) + }). + Times(1). + Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app"))) }, }, @@ -572,17 +593,18 @@ func TestRunAppDelete(t *testing.T) { appName: "app", global: true, wantErr: "failed to push to repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.Anything, &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(gomock.Any(), &git.PushOptions{ CommitMsg: "Deleted app 'app'", - }).Return("", fmt.Errorf("some error")) + }). + Times(1). + Return("", fmt.Errorf("some error")) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app"))) }, }, @@ -598,7 +620,7 @@ func TestRunAppDelete(t *testing.T) { prepareRepo = func(_ context.Context, _ *git.CloneOptions, _ string) (git.Repository, fs.FS, error) { var err error - repo, repofs, err = tt.prepareRepo() + repo, repofs, err = tt.prepareRepo(t) return repo, repofs, err } opts := &AppDeleteOptions{ diff --git a/cmd/commands/common_test.go b/cmd/commands/common_test.go index 82c01ec7..3d86c9d1 100644 --- a/cmd/commands/common_test.go +++ b/cmd/commands/common_test.go @@ -9,6 +9,7 @@ import ( "github.com/argoproj-labs/argocd-autopilot/pkg/git" gitmocks "github.com/argoproj-labs/argocd-autopilot/pkg/git/mocks" "github.com/argoproj-labs/argocd-autopilot/pkg/store" + "github.com/golang/mock/gomock" "github.com/go-git/go-billy/v5/memfs" billyUtils "github.com/go-git/go-billy/v5/util" @@ -19,14 +20,14 @@ func Test_prepareRepo(t *testing.T) { tests := map[string]struct { projectName string wantErr string - getRepo func() (git.Repository, fs.FS, error) + getRepo func(*testing.T) (git.Repository, fs.FS, error) assertFn func(*testing.T, git.Repository, fs.FS) }{ "Should complete when no errors are returned": { - getRepo: func() (git.Repository, fs.FS, error) { + getRepo: func(t *testing.T) (git.Repository, fs.FS, error) { repofs := fs.Create(memfs.New()) _ = repofs.MkdirAll(store.Default.BootsrtrapDir, 0666) - return &gitmocks.Repository{}, repofs, nil + return gitmocks.NewMockRepository(gomock.NewController(t)), repofs, nil }, assertFn: func(t *testing.T, r git.Repository, fs fs.FS) { assert.NotNil(t, r) @@ -35,14 +36,14 @@ func Test_prepareRepo(t *testing.T) { }, "Should fail when clone fails": { wantErr: "failed cloning the repository: some error", - getRepo: func() (git.Repository, fs.FS, error) { + getRepo: func(*testing.T) (git.Repository, fs.FS, error) { return nil, nil, errors.New("some error") }, }, "Should fail when there is no bootstrap at repo root": { wantErr: "bootstrap directory not found, please execute `repo bootstrap` command", - getRepo: func() (git.Repository, fs.FS, error) { - return &gitmocks.Repository{}, fs.Create(memfs.New()), nil + getRepo: func(t *testing.T) (git.Repository, fs.FS, error) { + return gitmocks.NewMockRepository(gomock.NewController(t)), fs.Create(memfs.New()), nil }, assertFn: func(t *testing.T, r git.Repository, fs fs.FS) { assert.NotNil(t, r) @@ -51,11 +52,11 @@ func Test_prepareRepo(t *testing.T) { }, "Should validate project existence if a projectName is supplied": { projectName: "project", - getRepo: func() (git.Repository, fs.FS, error) { + getRepo: func(t *testing.T) (git.Repository, fs.FS, error) { repofs := fs.Create(memfs.New()) _ = repofs.MkdirAll(store.Default.BootsrtrapDir, 0666) _ = billyUtils.WriteFile(repofs, repofs.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - return &gitmocks.Repository{}, repofs, nil + return gitmocks.NewMockRepository(gomock.NewController(t)), repofs, nil }, assertFn: func(t *testing.T, r git.Repository, fs fs.FS) { assert.NotNil(t, r) @@ -65,10 +66,10 @@ func Test_prepareRepo(t *testing.T) { "Should fail when project does not exist": { projectName: "project", wantErr: "project 'project' not found, please execute `argocd-autopilot project create project`", - getRepo: func() (git.Repository, fs.FS, error) { + getRepo: func(t *testing.T) (git.Repository, fs.FS, error) { repofs := fs.Create(memfs.New()) _ = repofs.MkdirAll(store.Default.BootsrtrapDir, 0666) - return &gitmocks.Repository{}, repofs, nil + return gitmocks.NewMockRepository(gomock.NewController(t)), repofs, nil }, }, } @@ -77,7 +78,7 @@ func Test_prepareRepo(t *testing.T) { for name, tt := range tests { t.Run(name, func(t *testing.T) { getRepo = func(_ context.Context, _ *git.CloneOptions) (git.Repository, fs.FS, error) { - return tt.getRepo() + return tt.getRepo(t) } r, fs, err := prepareRepo(context.Background(), &git.CloneOptions{}, tt.projectName) if err != nil { diff --git a/cmd/commands/project_test.go b/cmd/commands/project_test.go index ab721bb4..feacf8a7 100644 --- a/cmd/commands/project_test.go +++ b/cmd/commands/project_test.go @@ -22,10 +22,11 @@ import ( appset "github.com/argoproj/applicationset/api/v1alpha1" argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" "github.com/ghodss/yaml" + "github.com/golang/mock/gomock" + "github.com/go-git/go-billy/v5/memfs" billyUtils "github.com/go-git/go-billy/v5/util" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -34,19 +35,19 @@ func TestRunProjectCreate(t *testing.T) { projectName string wantErr string getInstallationNamespace func(repofs fs.FS) (string, error) - prepareRepo func() (git.Repository, fs.FS, error) + prepareRepo func(*testing.T) (git.Repository, fs.FS, error) assertFn func(t *testing.T, repo git.Repository, repofs fs.FS) }{ "should handle failure in prepare repo": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { return nil, nil, fmt.Errorf("failure clone") }, wantErr: "failure clone", }, "should handle failure while getting namespace": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() return nil, fs.Create(memfs), nil }, @@ -57,7 +58,7 @@ func TestRunProjectCreate(t *testing.T) { }, "should handle failure when project exists": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(*testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = billyUtils.WriteFile(memfs, "projects/project.yaml", []byte{}, 0666) return nil, fs.Create(memfs), nil @@ -69,12 +70,13 @@ func TestRunProjectCreate(t *testing.T) { }, "should handle failure when writing project file": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { - mockedFS := &fsmocks.FS{} - mockedFS.On("Root").Return("/") - mockedFS.On("Join", "projects", "project.yaml").Return("projects/project.yaml") - mockedFS.On("ExistsOrDie", "projects/project.yaml").Return(false) - mockedFS.On("OpenFile", "projects/project.yaml", mock.AnythingOfType("int"), mock.AnythingOfType("FileMode")).Return(nil, os.ErrPermission) + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { + mockedFS := fsmocks.NewMockFS(gomock.NewController(t)) + mockedFS.EXPECT().Join("projects", "project.yaml"). + Times(2). + Return("projects/project.yaml") + mockedFS.EXPECT().ExistsOrDie("projects/project.yaml").Return(false) + mockedFS.EXPECT().OpenFile("projects/project.yaml", gomock.Any(), gomock.Any()).Return(nil, os.ErrPermission) return nil, mockedFS, nil }, getInstallationNamespace: func(_ fs.FS) (string, error) { @@ -84,10 +86,10 @@ func TestRunProjectCreate(t *testing.T) { }, "should handle failure to persist repo": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() - mockedRepo := &gitmocks.Repository{} - mockedRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockedRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockedRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Added project 'project'", }).Return("", fmt.Errorf("failed to persist")) return mockedRepo, fs.Create(memfs), nil @@ -99,10 +101,10 @@ func TestRunProjectCreate(t *testing.T) { }, "should persist repo when done": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() - mockedRepo := &gitmocks.Repository{} - mockedRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockedRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockedRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Added project 'project'", }).Return("revision", nil) return mockedRepo, fs.Create(memfs), nil @@ -111,7 +113,6 @@ func TestRunProjectCreate(t *testing.T) { return "namespace", nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) exists := repofs.ExistsOrDie("projects/project.yaml") assert.True(t, exists) }, @@ -136,7 +137,7 @@ func TestRunProjectCreate(t *testing.T) { } prepareRepo = func(_ context.Context, _ *git.CloneOptions, _ string) (git.Repository, fs.FS, error) { var err error - repo, repofs, err = tt.prepareRepo() + repo, repofs, err = tt.prepareRepo(t) return repo, repofs, err } getInstallationNamespace = tt.getInstallationNamespace @@ -229,13 +230,12 @@ func Test_generateProjectManifests(t *testing.T) { func Test_getInstallationNamespace(t *testing.T) { tests := map[string]struct { - nsYAML string - beforeFn func() fs.FS + beforeFn func(*testing.T) fs.FS want string wantErr string }{ "should return the namespace from namespace.yaml": { - beforeFn: func() fs.FS { + beforeFn: func(*testing.T) fs.FS { namespace := &argocdv1alpha1.Application{ Spec: argocdv1alpha1.ApplicationSpec{ Destination: argocdv1alpha1.ApplicationDestination{ @@ -250,24 +250,28 @@ func Test_getInstallationNamespace(t *testing.T) { want: "namespace", }, "should handle file not found": { - beforeFn: func() fs.FS { + beforeFn: func(*testing.T) fs.FS { return fs.Create(memfs.New()) }, wantErr: "failed to unmarshal namespace: file does not exist", }, "should handle error during read": { - beforeFn: func() fs.FS { - mfs := &fsmocks.FS{} - mfs.On("Join", mock.AnythingOfType("string"), mock.AnythingOfType("string")).Return(func(elem ...string) string { - return strings.Join(elem, "/") - }) - mfs.On("ReadYamls", filepath.Join(store.Default.BootsrtrapDir, store.Default.ArgoCDName+".yaml"), mock.Anything).Return(nil, fmt.Errorf("some error")) + beforeFn: func(t *testing.T) fs.FS { + mfs := fsmocks.NewMockFS(gomock.NewController(t)) + mfs.EXPECT().Join(gomock.Any()). + Times(1). + DoAndReturn(func(elem ...string) string { + return strings.Join(elem, "/") + }) + mfs.EXPECT().ReadYamls(filepath.Join(store.Default.BootsrtrapDir, store.Default.ArgoCDName+".yaml"), gomock.Any()). + Times(1). + Return(fmt.Errorf("some error")) return mfs }, - wantErr: "failed to read namespace file: some error", + wantErr: "failed to unmarshal namespace: some error", }, "should handle corrupted namespace.yaml file": { - beforeFn: func() fs.FS { + beforeFn: func(*testing.T) fs.FS { repofs := fs.Create(memfs.New()) _ = billyUtils.WriteFile(repofs, filepath.Join(store.Default.BootsrtrapDir, store.Default.ArgoCDName+".yaml"), []byte("some string"), 0666) return repofs @@ -277,7 +281,7 @@ func Test_getInstallationNamespace(t *testing.T) { } for ttName, tt := range tests { t.Run(ttName, func(t *testing.T) { - repofs := tt.beforeFn() + repofs := tt.beforeFn(t) got, err := getInstallationNamespace(repofs) if err != nil { if tt.wantErr != "" { @@ -423,13 +427,13 @@ func TestRunProjectDelete(t *testing.T) { tests := map[string]struct { projectName string wantErr string - prepareRepo func() (git.Repository, fs.FS, error) + prepareRepo func(*testing.T) (git.Repository, fs.FS, error) assertFn func(t *testing.T, repo git.Repository, repofs fs.FS) }{ "Should fail when clone fails": { projectName: "project", wantErr: "some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { return nil, nil, fmt.Errorf("some error") }, }, @@ -519,25 +523,25 @@ func TestRunProjectDelete(t *testing.T) { "Should fail when failed to delete project.yaml file": { projectName: "project", wantErr: "failed to delete project 'project': " + os.ErrNotExist.Error(), - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"), 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", - }).Return("revision", fmt.Errorf("some error")) + }).Times(0) return mockRepo, fs.Create(memfs), nil }, }, "Should fail when persist fails": { projectName: "project", wantErr: "failed to push to repo: some error", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"), 0666) _ = billyUtils.WriteFile(memfs, filepath.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", }).Return("", fmt.Errorf("some error")) return mockRepo, fs.Create(memfs), nil @@ -545,60 +549,57 @@ func TestRunProjectDelete(t *testing.T) { }, "Should remove entire app folder, if it contains only one overlay": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"), 0666) _ = billyUtils.WriteFile(memfs, filepath.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", }).Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1"))) }, }, "Should remove only overlay, if app contains more overlays": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"), 0666) _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project2"), 0666) _ = billyUtils.WriteFile(memfs, filepath.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", }).Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.True(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir))) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"))) }, }, "Should remove directory apps": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", "project"), 0666) _ = billyUtils.WriteFile(memfs, filepath.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", }).Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1"))) }, }, "Should handle multiple apps": { projectName: "project", - prepareRepo: func() (git.Repository, fs.FS, error) { + prepareRepo: func(t *testing.T) (git.Repository, fs.FS, error) { memfs := memfs.New() _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"), 0666) _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project2"), 0666) @@ -607,14 +608,13 @@ func TestRunProjectDelete(t *testing.T) { _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app4", "project"), 0666) _ = memfs.MkdirAll(filepath.Join(store.Default.AppsDir, "app4", "project3"), 0666) _ = billyUtils.WriteFile(memfs, filepath.Join(store.Default.ProjectsDir, "project.yaml"), []byte{}, 0666) - mockRepo := &gitmocks.Repository{} - mockRepo.On("Persist", mock.AnythingOfType("*context.emptyCtx"), &git.PushOptions{ + mockRepo := gitmocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().Persist(context.Background(), &git.PushOptions{ CommitMsg: "Deleted project 'project'", }).Return("revision", nil) return mockRepo, fs.Create(memfs), nil }, assertFn: func(t *testing.T, repo git.Repository, repofs fs.FS) { - repo.(*gitmocks.Repository).AssertExpectations(t) assert.True(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir))) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app1", store.Default.OverlaysDir, "project"))) assert.False(t, repofs.ExistsOrDie(filepath.Join(store.Default.AppsDir, "app2"))) @@ -634,7 +634,7 @@ func TestRunProjectDelete(t *testing.T) { prepareRepo = func(_ context.Context, _ *git.CloneOptions, _ string) (git.Repository, fs.FS, error) { var err error - repo, repofs, err = tt.prepareRepo() + repo, repofs, err = tt.prepareRepo(t) return repo, repofs, err } opts := &ProjectDeleteOptions{ diff --git a/cmd/commands/repo_test.go b/cmd/commands/repo_test.go index 83a87219..c84afd6c 100644 --- a/cmd/commands/repo_test.go +++ b/cmd/commands/repo_test.go @@ -14,18 +14,18 @@ import ( "github.com/argoproj-labs/argocd-autopilot/pkg/kube" kubemocks "github.com/argoproj-labs/argocd-autopilot/pkg/kube/mocks" "github.com/argoproj-labs/argocd-autopilot/pkg/store" - argocdcommon "github.com/argoproj/argo-cd/v2/common" argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" "github.com/ghodss/yaml" - "github.com/go-git/go-billy/v5/memfs" - billyUtils "github.com/go-git/go-billy/v5/util" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" + "github.com/golang/mock/gomock" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" kusttypes "sigs.k8s.io/kustomize/api/types" + + "github.com/go-git/go-billy/v5/memfs" + billyUtils "github.com/go-git/go-billy/v5/util" + "github.com/stretchr/testify/assert" ) func Test_setBootstrapOptsDefaults(t *testing.T) { @@ -244,7 +244,7 @@ func TestRunRepoBootstrap(t *testing.T) { exitCalled := false tests := map[string]struct { opts *RepoBootstrapOptions - beforeFn func(*gitmocks.Repository, *kubemocks.Factory) + beforeFn func(*gitmocks.MockRepository, *kubemocks.MockFactory) assertFn func(*testing.T, fs.FS, error) }{ "DryRun": { @@ -257,7 +257,7 @@ func TestRunRepoBootstrap(t *testing.T) { Auth: git.Auth{Password: "test"}, }, }, - beforeFn: func(*gitmocks.Repository, *kubemocks.Factory) {}, + beforeFn: func(*gitmocks.MockRepository, *kubemocks.MockFactory) {}, assertFn: func(t *testing.T, _ fs.FS, ret error) { assert.NoError(t, ret) assert.True(t, exitCalled) @@ -272,7 +272,7 @@ func TestRunRepoBootstrap(t *testing.T) { Auth: git.Auth{Password: "test"}, }, }, - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { mockCS := fake.NewSimpleClientset(&v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "argocd-initial-admin-secret", @@ -282,10 +282,12 @@ func TestRunRepoBootstrap(t *testing.T) { "password": []byte("foo"), }, }) - r.On("Persist", mock.Anything, mock.Anything).Return("revision", nil) - f.On("Apply", mock.Anything, mock.Anything, mock.Anything).Return(nil) - f.On("Wait", mock.Anything, mock.Anything).Return(nil) - f.On("KubernetesClientSetOrDie").Return(mockCS) + r.EXPECT().Persist(gomock.Any(), gomock.Any()).Return("revision", nil) + f.EXPECT().Apply(gomock.Any(), gomock.Any()). + Times(2). + Return(nil) + f.EXPECT().Wait(gomock.Any(), gomock.Any()).Return(nil) + f.EXPECT().KubernetesClientSetOrDie().Return(mockCS) }, assertFn: func(t *testing.T, repofs fs.FS, ret error) { assert.NoError(t, ret) @@ -328,7 +330,7 @@ func TestRunRepoBootstrap(t *testing.T) { Auth: git.Auth{Password: "test"}, }, }, - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { mockCS := fake.NewSimpleClientset(&v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "argocd-initial-admin-secret", @@ -338,10 +340,12 @@ func TestRunRepoBootstrap(t *testing.T) { "password": []byte("foo"), }, }) - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Bootstrap"}).Return("revision", nil) - f.On("Apply", mock.Anything, mock.Anything, mock.Anything).Return(nil) - f.On("Wait", mock.Anything, mock.Anything).Return(nil) - f.On("KubernetesClientSetOrDie").Return(mockCS) + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Bootstrap"}).Return("revision", nil) + f.EXPECT().Apply(gomock.Any(), gomock.Any()). + Times(2). + Return(nil) + f.EXPECT().Wait(gomock.Any(), gomock.Any()).Return(nil) + f.EXPECT().KubernetesClientSetOrDie().Return(mockCS) }, assertFn: func(t *testing.T, repofs fs.FS, ret error) { assert.NoError(t, ret) @@ -390,9 +394,10 @@ func TestRunRepoBootstrap(t *testing.T) { for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - r := &gitmocks.Repository{} + ctrl := gomock.NewController(t) + r := gitmocks.NewMockRepository(ctrl) + f := kubemocks.NewMockFactory(ctrl) repofs := fs.Create(memfs.New()) - f := &kubemocks.Factory{} exitCalled = false tt.beforeFn(r, f) @@ -403,8 +408,6 @@ func TestRunRepoBootstrap(t *testing.T) { err := RunRepoBootstrap(context.Background(), tt.opts) tt.assertFn(t, repofs, err) - r.AssertExpectations(t) - f.AssertExpectations(t) }) } } @@ -417,16 +420,19 @@ func Test_setUninstallOptsDefaults(t *testing.T) { }{ "Should not change anything, if all options are set": { opts: RepoUninstallOptions{ - Namespace: "namespace", + Namespace: "namespace", + KubeContextName: "test", }, want: &RepoUninstallOptions{ - Namespace: "namespace", + Namespace: "namespace", + KubeContextName: "test", }, }, "Should set default argocd namespace, if it is not set": { opts: RepoUninstallOptions{}, want: &RepoUninstallOptions{ - Namespace: store.Default.ArgoCDNamespace, + Namespace: store.Default.ArgoCDNamespace, + KubeContextName: "test", }, }, } @@ -434,8 +440,8 @@ func Test_setUninstallOptsDefaults(t *testing.T) { defer func() { currentKubeContext = origCurrentKubeContext }() for name, tt := range tests { t.Run(name, func(t *testing.T) { - if tt.currentKubeContext != nil { - currentKubeContext = tt.currentKubeContext + currentKubeContext = func() (string, error) { + return "test", nil } got, _ := setUninstallOptsDefaults(tt.opts) @@ -479,13 +485,11 @@ func Test_deleteGitOpsFiles(t *testing.T) { func Test_deleteClusterResources(t *testing.T) { tests := map[string]struct { - beforeFn func() kube.Factory + beforeFn func(*kubemocks.MockFactory) assertFn func(*testing.T, kube.Factory, error) }{ "Should delete all resources": { - beforeFn: func() kube.Factory { - mf := &kubemocks.Factory{} - + beforeFn: func(mf *kubemocks.MockFactory) { labelSelectors := []string{ store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, argocdcommon.LabelKeyAppInstance + "=" + store.Default.ArgoCDName, @@ -494,11 +498,11 @@ func Test_deleteClusterResources(t *testing.T) { } for _, labelSelector := range labelSelectors { - mf.On("Delete", mock.Anything, &kube.DeleteOptions{ + mf.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{"applications", "secrets"}, }).Return(nil) - mf.On("Delete", mock.Anything, &kube.DeleteOptions{ + mf.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{ "all", @@ -511,45 +515,35 @@ func Test_deleteClusterResources(t *testing.T) { }, }).Return(nil) } - - return mf }, assertFn: func(t *testing.T, f kube.Factory, err error) { assert.Nil(t, err) - f.(*kubemocks.Factory).AssertExpectations(t) }, }, "Should fail if failed to delete argocd-autopilot resources": { - beforeFn: func() kube.Factory { - mf := &kubemocks.Factory{} - + beforeFn: func(mf *kubemocks.MockFactory) { labelSelectors := []string{ store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, } for _, labelSelector := range labelSelectors { - mf.On("Delete", mock.Anything, &kube.DeleteOptions{ + mf.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{"applications", "secrets"}, }).Return(errors.New("some error")) } - - return mf }, assertFn: func(t *testing.T, f kube.Factory, err error) { assert.EqualError(t, err, "failed deleting argocd-autopilot resources: some error") - f.(*kubemocks.Factory).AssertExpectations(t) }, }, "Should fail if failed to delete Argo-CD resources": { - beforeFn: func() kube.Factory { - mf := &kubemocks.Factory{} - - mf.On("Delete", mock.Anything, &kube.DeleteOptions{ + beforeFn: func(mf *kubemocks.MockFactory) { + mf.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, ResourceTypes: []string{"applications", "secrets"}, }).Return(nil) - mf.On("Delete", mock.Anything, &kube.DeleteOptions{ + mf.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, ResourceTypes: []string{ "all", @@ -561,18 +555,16 @@ func Test_deleteClusterResources(t *testing.T) { "roles", }, }).Return(errors.New("some error")) - - return mf }, assertFn: func(t *testing.T, f kube.Factory, err error) { assert.EqualError(t, err, "failed deleting Argo-CD resources: some error") - f.(*kubemocks.Factory).AssertExpectations(t) }, }, } for name, tt := range tests { t.Run(name, func(t *testing.T) { - f := tt.beforeFn() + f := kubemocks.NewMockFactory(gomock.NewController(t)) + tt.beforeFn(f) err := deleteClusterResources(context.Background(), &deleteClusterResourcesOptions{ KubeFactory: f, Timeout: 0, @@ -588,7 +580,7 @@ func TestRunRepoUninstall(t *testing.T) { currentKubeContextErr error getRepoErr error wantErr string - beforeFn func(*gitmocks.Repository, *kubemocks.Factory) + beforeFn func(*gitmocks.MockRepository, *kubemocks.MockFactory) }{ "Should fail if getCurrentKubeContext fails": { currentKubeContextErr: errors.New("some error"), @@ -600,28 +592,33 @@ func TestRunRepoUninstall(t *testing.T) { }, "Should fail if Persist fails": { wantErr: "some error", - beforeFn: func(r *gitmocks.Repository, _ *kubemocks.Factory) { - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall"}).Return("", errors.New("some error")) + beforeFn: func(r *gitmocks.MockRepository, _ *kubemocks.MockFactory) { + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall"}). + Return("", errors.New("some error")) }, }, "Should fail if Wait fails": { wantErr: "some error", - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall"}).Return("revision", nil) - f.On("Wait", mock.Anything, mock.Anything).Return(errors.New("some error")) + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall"}). + Return("revision", nil) + f.EXPECT().Wait(gomock.Any(), gomock.Any()).Return(errors.New("some error")) }, }, "Should fail if deleteClusterResources fails": { wantErr: "failed deleting argocd-autopilot resources: some error", - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall"}).Return("revision", nil) - f.On("Wait", mock.Anything, mock.Anything).Return(nil) - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall"}). + Return("revision", nil) + f.EXPECT().Wait(gomock.Any(), gomock.Any()). + Return(nil) + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, ResourceTypes: []string{"applications", "secrets"}, WaitForDeletion: false, - }).Return(errors.New("some error")) - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + }). + Return(errors.New("some error")) + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, ResourceTypes: []string{ "all", @@ -632,15 +629,19 @@ func TestRunRepoUninstall(t *testing.T) { "rolebindings", "roles", }, WaitForDeletion: false, - }).Return(errors.New("some error")) + }). + Times(0) }, }, "Should fail if 2nd Persist fails": { wantErr: "some error", - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall"}).Return("revision", nil) - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall, deleted leftovers"}).Return("", errors.New("some error")) - f.On("Wait", mock.Anything, mock.Anything).Return(nil) + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall"}). + Return("revision", nil) + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall, deleted leftovers"}). + Return("", errors.New("some error")) + f.EXPECT().Wait(gomock.Any(), gomock.Any()). + Return(nil) labelSelectors := []string{ store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, @@ -650,11 +651,12 @@ func TestRunRepoUninstall(t *testing.T) { } for _, labelSelector := range labelSelectors { - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{"applications", "secrets"}, - }).Return(nil) - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + }). + Return(nil) + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{ "all", @@ -665,15 +667,19 @@ func TestRunRepoUninstall(t *testing.T) { "rolebindings", "roles", }, - }).Return(nil) + }). + Return(nil) } }, }, "Should succeed if no errors": { - beforeFn: func(r *gitmocks.Repository, f *kubemocks.Factory) { - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall"}).Return("revision", nil) - r.On("Persist", mock.Anything, &git.PushOptions{CommitMsg: "Autopilot Uninstall, deleted leftovers"}).Return("", nil) - f.On("Wait", mock.Anything, mock.Anything).Return(nil) + beforeFn: func(r *gitmocks.MockRepository, f *kubemocks.MockFactory) { + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall"}). + Return("revision", nil) + r.EXPECT().Persist(gomock.Any(), &git.PushOptions{CommitMsg: "Autopilot Uninstall, deleted leftovers"}). + Return("", nil) + f.EXPECT().Wait(gomock.Any(), gomock.Any()). + Return(nil) labelSelectors := []string{ store.Default.LabelKeyAppManagedBy + "=" + store.Default.LabelValueManagedBy, @@ -683,12 +689,13 @@ func TestRunRepoUninstall(t *testing.T) { } for _, labelSelector := range labelSelectors { - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{"applications", "secrets"}, - }).Return(nil) + }). + Return(nil) - f.On("Delete", mock.Anything, &kube.DeleteOptions{ + f.EXPECT().Delete(gomock.Any(), &kube.DeleteOptions{ LabelSelector: labelSelector, ResourceTypes: []string{ "all", @@ -699,7 +706,8 @@ func TestRunRepoUninstall(t *testing.T) { "rolebindings", "roles", }, - }).Return(nil) + }). + Return(nil) } }, }, @@ -709,9 +717,10 @@ func TestRunRepoUninstall(t *testing.T) { defer func() { getRepo, currentKubeContext = origGetRepo, origCurrentKubeContext }() for name, tt := range tests { t.Run(name, func(t *testing.T) { - r := &gitmocks.Repository{} + ctrl := gomock.NewController(t) + r := gitmocks.NewMockRepository(ctrl) repofs := fs.Create(memfs.New()) - f := &kubemocks.Factory{} + f := kubemocks.NewMockFactory(ctrl) if tt.beforeFn != nil { tt.beforeFn(r, f) @@ -750,9 +759,6 @@ func TestRunRepoUninstall(t *testing.T) { return } - - r.AssertExpectations(t) - f.AssertExpectations(t) }) } } diff --git a/go.mod b/go.mod index d14fc1b5..72b79792 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,13 @@ go 1.17 require ( code.gitea.io/sdk/gitea v0.15.1 github.com/argoproj/applicationset v0.4.1 - github.com/argoproj/argo-cd/v2 v2.3.1 - github.com/argoproj/gitops-engine v0.6.0 + github.com/argoproj/argo-cd/v2 v2.3.2 + github.com/argoproj/gitops-engine v0.6.1 github.com/briandowns/spinner v1.18.1 github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.3.1 github.com/go-git/go-git/v5 v5.4.2 + github.com/golang/mock v1.6.0 github.com/google/go-github/v35 v35.3.0 github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 github.com/sirupsen/logrus v1.8.1 @@ -170,10 +171,9 @@ require ( github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c // indirect github.com/slack-go/slack v0.10.1 // indirect github.com/soheilhy/cmux v0.1.5 // indirect - github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/afero v1.8.0 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/stretchr/objx v0.2.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/vmihailenco/go-tinylfu v0.2.1 // indirect github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect @@ -184,13 +184,13 @@ require ( github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect go.mongodb.org/mongo-driver v1.1.2 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect - golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect + golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect golang.org/x/exp v0.0.0-20210901193431-a062eea981d2 // indirect golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect gomodules.xyz/envconfig v1.3.1-0.20190308184047-426f31af0d45 // indirect @@ -203,7 +203,7 @@ require ( gopkg.in/go-playground/webhooks.v5 v5.11.0 // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/ini.v1 v1.66.3 // indirect gopkg.in/square/go-jose.v2 v2.2.2 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index f47b47fb..16af5eae 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -17,6 +18,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -48,6 +50,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE= code.gitea.io/sdk/gitea v0.15.1 h1:WJreC7YYuxbn0UDaPuWIe/mtiNKTvLN8MLkaw71yx/M= code.gitea.io/sdk/gitea v0.15.1/go.mod h1:klY2LVI3s3NChzIk/MzMn7G1FHrfU7qd63iSMVoHRBA= @@ -147,10 +150,11 @@ github.com/appscode/go v0.0.0-20190808133642-1d4ef1f1c1e0/go.mod h1:iy07dV61Z7QQ github.com/argoproj/applicationset v0.4.1 h1:PzTn77TK7XQB3CdpCDPbwU4pQgip0x4qvuJQ8XiBk5E= github.com/argoproj/applicationset v0.4.1/go.mod h1:cJZ7CWG80kBII4QNalyAvSr8eVifo8jKkyXoVl9qXaA= github.com/argoproj/argo-cd/v2 v2.3.0-rc5.0.20220225234205-31676e2aea6f/go.mod h1:PQw/102hk/8LmuMy0daLH1SIFYq3f95cUya+3NZP3xg= -github.com/argoproj/argo-cd/v2 v2.3.1 h1:67HBWMwgu64XOY+9FXNtKcnaSqg8PqrTdp/cL9OrgS4= -github.com/argoproj/argo-cd/v2 v2.3.1/go.mod h1:PQw/102hk/8LmuMy0daLH1SIFYq3f95cUya+3NZP3xg= -github.com/argoproj/gitops-engine v0.6.0 h1:Tnh6kUUVuBV0m3gueYIymAeErWl9XNN9O9JcOoNM0vU= +github.com/argoproj/argo-cd/v2 v2.3.2 h1:IqKaRDKnJG34XJSaD2Vv3DzdczfiHHtHw33cGnhYUAg= +github.com/argoproj/argo-cd/v2 v2.3.2/go.mod h1:MTHjKkegafoqMLsA4FBcBe4t2Q9XKu4S7g0YgyGqnVs= github.com/argoproj/gitops-engine v0.6.0/go.mod h1:pRgVpLW7pZqf7n3COJ7UcDepk4cI61LAcJd64Q3Jq/c= +github.com/argoproj/gitops-engine v0.6.1 h1:fiaMQ+0OfBHQWInekgkO645i4dolvl3KA//0F7n4PK8= +github.com/argoproj/gitops-engine v0.6.1/go.mod h1:pRgVpLW7pZqf7n3COJ7UcDepk4cI61LAcJd64Q3Jq/c= github.com/argoproj/notifications-engine v0.3.1-0.20220127183449-91deed20b998 h1:V9RDg+IZeebnm3XjkfkbN07VM21Fu1Cy/RJNoHO++VM= github.com/argoproj/notifications-engine v0.3.1-0.20220127183449-91deed20b998/go.mod h1:5mKv7zEgI3NO0L+fsuRSwBSY9EIXSuyIsDND8O8TTIw= github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 h1:Cfp7rO/HpVxnwlRqJe0jHiBbZ77ZgXhB6HWlYD02Xdc= @@ -547,6 +551,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -567,6 +572,7 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 h1:4EZlYQIiyecYJlUbVkFXCXHz1QPhVXcHnQKAzBTPfQo= github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4/go.mod h1:lEO7XoHJ/xNRBCxrn4h/CEB67h0kW1B0t4ooP2yrjUA= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -919,6 +925,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1022,8 +1029,9 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.8.0 h1:5MmtuhAgYeU6qpa7w7bP0dv6MBYuup0vekhSpSkoq60= +github.com/spf13/afero v1.8.0/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= @@ -1199,8 +1207,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1309,6 +1319,7 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1421,6 +1432,7 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1430,6 +1442,7 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1451,11 +1464,13 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1540,6 +1555,7 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -1648,7 +1664,9 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1714,8 +1732,9 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.3 h1:jRskFVxYaMGAMUbN0UZ7niA9gzL9B49DOqE78vg0k3w= +gopkg.in/ini.v1 v1.66.3/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA= diff --git a/pkg/application/application.go b/pkg/application/application.go index 1333778f..60ed7671 100644 --- a/pkg/application/application.go +++ b/pkg/application/application.go @@ -23,7 +23,7 @@ import ( "sigs.k8s.io/kustomize/kyaml/filesys" ) -//go:generate mockery --name Application --filename application.go +//go:generate mockgen -destination=./mocks/application.go -package=mocks -source=./application.go Application const ( InstallationModeFlat = "flat" diff --git a/pkg/application/application_test.go b/pkg/application/application_test.go index 2cb6434b..97788347 100644 --- a/pkg/application/application_test.go +++ b/pkg/application/application_test.go @@ -14,8 +14,8 @@ import ( "github.com/ghodss/yaml" "github.com/go-git/go-billy/v5/memfs" billyUtils "github.com/go-git/go-billy/v5/util" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" v1 "k8s.io/api/core/v1" kusttypes "sigs.k8s.io/kustomize/api/types" ) @@ -173,7 +173,7 @@ func Test_writeFile(t *testing.T) { tests := map[string]struct { args args assertFn func(t *testing.T, repofs fs.FS, exists bool, err error) - beforeFn func(repofs fs.FS) fs.FS + beforeFn func(t *testing.T, repofs fs.FS) fs.FS }{ "On Root": { args: args{ @@ -219,7 +219,7 @@ func Test_writeFile(t *testing.T) { name: "test", data: []byte("data2"), }, - beforeFn: func(repofs fs.FS) fs.FS { + beforeFn: func(t *testing.T, repofs fs.FS) fs.FS { _ = billyUtils.WriteFile(repofs, "/foo/bar", []byte("data"), 0666) return repofs }, @@ -234,11 +234,17 @@ func Test_writeFile(t *testing.T) { name: "test", data: []byte("data2"), }, - beforeFn: func(_ fs.FS) fs.FS { - mfs := &fsmocks.FS{} - mfs.On("CheckExistsOrWrite", mock.Anything, mock.Anything).Return(false, errors.New("error")) - mfs.On("Root").Return("/") - mfs.On("Join", mock.Anything, mock.Anything).Return("/foo/bar") + beforeFn: func(t *testing.T, _ fs.FS) fs.FS { + mfs := fsmocks.NewMockFS(gomock.NewController(t)) + mfs.EXPECT().CheckExistsOrWrite(gomock.Any(), gomock.Any()). + Times(1). + Return(false, errors.New("error")) + mfs.EXPECT().Root(). + Times(1). + Return("/") + mfs.EXPECT().Join(gomock.Any(), gomock.Any()). + Times(1). + Return("/foo/bar") return mfs }, assertFn: func(t *testing.T, _ fs.FS, _ bool, ret error) { @@ -256,7 +262,7 @@ func Test_writeFile(t *testing.T) { } if tt.beforeFn != nil { - repofs = tt.beforeFn(repofs) + repofs = tt.beforeFn(t, repofs) } got, err := writeFile(repofs, tt.args.path, tt.args.name, tt.args.data) diff --git a/pkg/application/mocks/application.go b/pkg/application/mocks/application.go index 8112bd96..0c457a10 100644 --- a/pkg/application/mocks/application.go +++ b/pkg/application/mocks/application.go @@ -1,41 +1,63 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./application.go +// Package mocks is a generated GoMock package. package mocks import ( + reflect "reflect" + fs "github.com/argoproj-labs/argocd-autopilot/pkg/fs" - mock "github.com/stretchr/testify/mock" + gomock "github.com/golang/mock/gomock" ) -// Application is an autogenerated mock type for the Application type -type Application struct { - mock.Mock +// MockApplication is a mock of Application interface. +type MockApplication struct { + ctrl *gomock.Controller + recorder *MockApplicationMockRecorder } -// CreateFiles provides a mock function with given fields: repofs, appsfs, projectName -func (_m *Application) CreateFiles(repofs fs.FS, appsfs fs.FS, projectName string) error { - ret := _m.Called(repofs, appsfs, projectName) +// MockApplicationMockRecorder is the mock recorder for MockApplication. +type MockApplicationMockRecorder struct { + mock *MockApplication +} - var r0 error - if rf, ok := ret.Get(0).(func(fs.FS, fs.FS, string) error); ok { - r0 = rf(repofs, appsfs, projectName) - } else { - r0 = ret.Error(0) - } +// NewMockApplication creates a new mock instance. +func NewMockApplication(ctrl *gomock.Controller) *MockApplication { + mock := &MockApplication{ctrl: ctrl} + mock.recorder = &MockApplicationMockRecorder{mock} + return mock +} - return r0 +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockApplication) EXPECT() *MockApplicationMockRecorder { + return m.recorder } -// Name provides a mock function with given fields: -func (_m *Application) Name() string { - ret := _m.Called() +// CreateFiles mocks base method. +func (m *MockApplication) CreateFiles(repofs, appsfs fs.FS, projectName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateFiles", repofs, appsfs, projectName) + ret0, _ := ret[0].(error) + return ret0 +} - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } +// CreateFiles indicates an expected call of CreateFiles. +func (mr *MockApplicationMockRecorder) CreateFiles(repofs, appsfs, projectName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFiles", reflect.TypeOf((*MockApplication)(nil).CreateFiles), repofs, appsfs, projectName) +} + +// Name mocks base method. +func (m *MockApplication) Name() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) + return ret0 +} - return r0 +// Name indicates an expected call of Name. +func (mr *MockApplicationMockRecorder) Name() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockApplication)(nil).Name)) } diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index 0c7bb744..57429f1b 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -13,7 +13,7 @@ import ( billyUtils "github.com/go-git/go-billy/v5/util" ) -//go:generate mockery --name FS --filename fs.go +//go:generate mockgen -destination=./mocks/fs.go -package=mocks -source=./fs.go FS type FS interface { billy.Filesystem diff --git a/pkg/fs/fs_test.go b/pkg/fs/fs_test.go index 799c963a..0a3950e3 100644 --- a/pkg/fs/fs_test.go +++ b/pkg/fs/fs_test.go @@ -9,13 +9,13 @@ import ( "github.com/argoproj-labs/argocd-autopilot/pkg/fs/mocks" "github.com/argoproj-labs/argocd-autopilot/pkg/util" + "github.com/golang/mock/gomock" "github.com/ghodss/yaml" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" billyUtils "github.com/go-git/go-billy/v5/util" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -50,37 +50,39 @@ func TestCreate(t *testing.T) { func Test_fsimpl_Exists(t *testing.T) { tests := map[string]struct { - fs billy.Filesystem - beforeFn func(fs FS) + beforeFn func(*testing.T) billy.Filesystem path string want bool wantErr bool }{ "Should exist": { - fs: memfs.New(), path: "/foo/noam/bar", - beforeFn: func(fs FS) { + beforeFn: func(_ *testing.T) billy.Filesystem { + fs := memfs.New() f, err := fs.Create("/foo/noam/bar") util.Die(err) defer f.Close() + return fs }, want: true, wantErr: false, }, "Should not exist": { - fs: memfs.New(), - path: "/foo/noam/bar", - beforeFn: func(fs FS) {}, - want: false, - wantErr: false, + path: "/foo/noam/bar", + beforeFn: func(_ *testing.T) billy.Filesystem { + return memfs.New() + }, + want: false, + wantErr: false, }, "Should throw error": { - fs: &mocks.FS{}, path: "invalid file path", - beforeFn: func(fs FS) { - f := fs.(*fsimpl) - m := f.Filesystem.(*mocks.FS) - m.On("Stat", mock.Anything).Return(nil, fmt.Errorf("error")) + beforeFn: func(t *testing.T) billy.Filesystem { + m := mocks.NewMockFS(gomock.NewController(t)) + m.EXPECT().Stat("invalid file path"). + Times(1). + Return(nil, fmt.Errorf("error")) + return m }, want: false, wantErr: true, @@ -88,8 +90,7 @@ func Test_fsimpl_Exists(t *testing.T) { } for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - fs := &fsimpl{tt.fs} - tt.beforeFn(fs) + fs := &fsimpl{Filesystem: tt.beforeFn(t)} got, err := fs.Exists(tt.path) if (err != nil) != tt.wantErr { t.Errorf("fs.Exists() error = %v, wantErr %v", err, tt.wantErr) @@ -111,46 +112,43 @@ func Test_fsimpl_CheckExistsOrWrite(t *testing.T) { args args want bool wantErr string - beforeFn func(m *mocks.FS) + beforeFn func(m *mocks.MockFS) }{ "should exists": { args: args{path: "/usr/bar", data: []byte{}}, want: true, - beforeFn: func(m *mocks.FS) { - m.On("Stat", "/usr/bar").Return(nil, nil) + beforeFn: func(m *mocks.MockFS) { + m.EXPECT().Stat("/usr/bar"). + Times(1). + Return(nil, nil) }, }, "should error on fail check": { args: args{path: "/usr/bar", data: []byte{}}, wantErr: "failed to check if file exists on repo at '/usr/bar': some error", - beforeFn: func(m *mocks.FS) { - m.On("Stat", "/usr/bar").Return(nil, fmt.Errorf("some error")) - }, - }, - "should write to file if not exists and write sucsseded": { - args: args{path: "/usr/bar", data: []byte{}}, - want: false, - beforeFn: func(m *mocks.FS) { - mfile := &mocks.File{} - mfile.On("Write", mock.AnythingOfType("[]uint8")).Return(1, nil) - mfile.On("Close").Return(nil) - m.On("Stat", "/usr/bar").Return(nil, os.ErrNotExist) - m.On("OpenFile", "/usr/bar", mock.AnythingOfType("int"), mock.AnythingOfType("FileMode")).Return(mfile, nil) + beforeFn: func(m *mocks.MockFS) { + m.EXPECT().Stat("/usr/bar"). + Times(1). + Return(nil, fmt.Errorf("some error")) }, }, "should fail if WriteFile failed": { args: args{path: "/usr/bar", data: []byte{}}, want: false, wantErr: "failed to create file at '/usr/bar': " + os.ErrPermission.Error(), - beforeFn: func(m *mocks.FS) { - m.On("Stat", "/usr/bar").Return(nil, os.ErrNotExist) - m.On("OpenFile", "/usr/bar", mock.AnythingOfType("int"), mock.AnythingOfType("FileMode")).Return(nil, os.ErrPermission) + beforeFn: func(m *mocks.MockFS) { + m.EXPECT().Stat("/usr/bar"). + Times(1). + Return(nil, os.ErrNotExist) + m.EXPECT().OpenFile("/usr/bar", gomock.Any(), gomock.Any()). + Times(1). + Return(nil, os.ErrPermission) }, }, } for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockedFS := &mocks.FS{} + mockedFS := mocks.NewMockFS(gomock.NewController(t)) tt.beforeFn(mockedFS) fs := Create(mockedFS) got, err := fs.CheckExistsOrWrite(tt.args.path, tt.args.data) @@ -177,20 +175,22 @@ func Test_fsimpl_ExistsOrDie(t *testing.T) { path string want bool wantErr bool - beforeFn func(m *mocks.FS) + beforeFn func(m *mocks.MockFS) }{ "should exists if path exists": { path: "/usr/bar", want: true, wantErr: false, - beforeFn: func(m *mocks.FS) { - m.On("Stat", mock.Anything).Return(nil, nil) + beforeFn: func(m *mocks.MockFS) { + m.EXPECT().Stat("/usr/bar"). + Times(1). + Return(nil, nil) }, }, } for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mock := &mocks.FS{} + mock := mocks.NewMockFS(gomock.NewController(t)) fs := Create(mock) tt.beforeFn(mock) if got := fs.ExistsOrDie(tt.path); got != tt.want { diff --git a/pkg/fs/mocks/file.go b/pkg/fs/mocks/file.go deleted file mode 100644 index 6ddc8bd5..00000000 --- a/pkg/fs/mocks/file.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// File is an autogenerated mock type for the File type -type File struct { - mock.Mock -} - -// Close provides a mock function with given fields: -func (_m *File) Close() error { - ret := _m.Called() - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Lock provides a mock function with given fields: -func (_m *File) Lock() error { - ret := _m.Called() - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Name provides a mock function with given fields: -func (_m *File) Name() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// Read provides a mock function with given fields: p -func (_m *File) Read(p []byte) (int, error) { - ret := _m.Called(p) - - var r0 int - if rf, ok := ret.Get(0).(func([]byte) int); ok { - r0 = rf(p) - } else { - r0 = ret.Get(0).(int) - } - - var r1 error - if rf, ok := ret.Get(1).(func([]byte) error); ok { - r1 = rf(p) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadAt provides a mock function with given fields: p, off -func (_m *File) ReadAt(p []byte, off int64) (int, error) { - ret := _m.Called(p, off) - - var r0 int - if rf, ok := ret.Get(0).(func([]byte, int64) int); ok { - r0 = rf(p, off) - } else { - r0 = ret.Get(0).(int) - } - - var r1 error - if rf, ok := ret.Get(1).(func([]byte, int64) error); ok { - r1 = rf(p, off) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Seek provides a mock function with given fields: offset, whence -func (_m *File) Seek(offset int64, whence int) (int64, error) { - ret := _m.Called(offset, whence) - - var r0 int64 - if rf, ok := ret.Get(0).(func(int64, int) int64); ok { - r0 = rf(offset, whence) - } else { - r0 = ret.Get(0).(int64) - } - - var r1 error - if rf, ok := ret.Get(1).(func(int64, int) error); ok { - r1 = rf(offset, whence) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Truncate provides a mock function with given fields: size -func (_m *File) Truncate(size int64) error { - ret := _m.Called(size) - - var r0 error - if rf, ok := ret.Get(0).(func(int64) error); ok { - r0 = rf(size) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Unlock provides a mock function with given fields: -func (_m *File) Unlock() error { - ret := _m.Called() - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Write provides a mock function with given fields: p -func (_m *File) Write(p []byte) (int, error) { - ret := _m.Called(p) - - var r0 int - if rf, ok := ret.Get(0).(func([]byte) int); ok { - r0 = rf(p) - } else { - r0 = ret.Get(0).(int) - } - - var r1 error - if rf, ok := ret.Get(1).(func([]byte) error); ok { - r1 = rf(p) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/pkg/fs/mocks/fs.go b/pkg/fs/mocks/fs.go index e964cdeb..df3fdc9b 100644 --- a/pkg/fs/mocks/fs.go +++ b/pkg/fs/mocks/fs.go @@ -1,452 +1,384 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./fs.go +// Package mocks is a generated GoMock package. package mocks import ( - billy "github.com/go-git/go-billy/v5" - - iofs "io/fs" + os "os" + reflect "reflect" - mock "github.com/stretchr/testify/mock" + billy "github.com/go-git/go-billy/v5" + gomock "github.com/golang/mock/gomock" ) -// FS is an autogenerated mock type for the FS type -type FS struct { - mock.Mock +// MockFS is a mock of FS interface. +type MockFS struct { + ctrl *gomock.Controller + recorder *MockFSMockRecorder } -// CheckExistsOrWrite provides a mock function with given fields: filename, data -func (_m *FS) CheckExistsOrWrite(filename string, data []byte) (bool, error) { - ret := _m.Called(filename, data) - - var r0 bool - if rf, ok := ret.Get(0).(func(string, []byte) bool); ok { - r0 = rf(filename, data) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, []byte) error); ok { - r1 = rf(filename, data) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// MockFSMockRecorder is the mock recorder for MockFS. +type MockFSMockRecorder struct { + mock *MockFS } -// Chroot provides a mock function with given fields: path -func (_m *FS) Chroot(path string) (billy.Filesystem, error) { - ret := _m.Called(path) - - var r0 billy.Filesystem - if rf, ok := ret.Get(0).(func(string) billy.Filesystem); ok { - r0 = rf(path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(billy.Filesystem) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// NewMockFS creates a new mock instance. +func NewMockFS(ctrl *gomock.Controller) *MockFS { + mock := &MockFS{ctrl: ctrl} + mock.recorder = &MockFSMockRecorder{mock} + return mock } -// Create provides a mock function with given fields: filename -func (_m *FS) Create(filename string) (billy.File, error) { - ret := _m.Called(filename) - - var r0 billy.File - if rf, ok := ret.Get(0).(func(string) billy.File); ok { - r0 = rf(filename) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(billy.File) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(filename) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockFS) EXPECT() *MockFSMockRecorder { + return m.recorder } -// Exists provides a mock function with given fields: path -func (_m *FS) Exists(path string) (bool, error) { - ret := _m.Called(path) - - var r0 bool - if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(path) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// CheckExistsOrWrite mocks base method. +func (m *MockFS) CheckExistsOrWrite(filename string, data []byte) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckExistsOrWrite", filename, data) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// ExistsOrDie provides a mock function with given fields: path -func (_m *FS) ExistsOrDie(path string) bool { - ret := _m.Called(path) - - var r0 bool - if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(path) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 +// CheckExistsOrWrite indicates an expected call of CheckExistsOrWrite. +func (mr *MockFSMockRecorder) CheckExistsOrWrite(filename, data interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckExistsOrWrite", reflect.TypeOf((*MockFS)(nil).CheckExistsOrWrite), filename, data) } -// Join provides a mock function with given fields: elem -func (_m *FS) Join(elem ...string) string { - _va := make([]interface{}, len(elem)) - for _i := range elem { - _va[_i] = elem[_i] - } - var _ca []interface{} - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 string - if rf, ok := ret.Get(0).(func(...string) string); ok { - r0 = rf(elem...) - } else { - r0 = ret.Get(0).(string) - } - - return r0 +// Chroot mocks base method. +func (m *MockFS) Chroot(path string) (billy.Filesystem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Chroot", path) + ret0, _ := ret[0].(billy.Filesystem) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Lstat provides a mock function with given fields: filename -func (_m *FS) Lstat(filename string) (iofs.FileInfo, error) { - ret := _m.Called(filename) - - var r0 iofs.FileInfo - if rf, ok := ret.Get(0).(func(string) iofs.FileInfo); ok { - r0 = rf(filename) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(iofs.FileInfo) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(filename) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Chroot indicates an expected call of Chroot. +func (mr *MockFSMockRecorder) Chroot(path interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chroot", reflect.TypeOf((*MockFS)(nil).Chroot), path) } -// MkdirAll provides a mock function with given fields: filename, perm -func (_m *FS) MkdirAll(filename string, perm iofs.FileMode) error { - ret := _m.Called(filename, perm) - - var r0 error - if rf, ok := ret.Get(0).(func(string, iofs.FileMode) error); ok { - r0 = rf(filename, perm) - } else { - r0 = ret.Error(0) - } - - return r0 +// Create mocks base method. +func (m *MockFS) Create(filename string) (billy.File, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", filename) + ret0, _ := ret[0].(billy.File) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Open provides a mock function with given fields: filename -func (_m *FS) Open(filename string) (billy.File, error) { - ret := _m.Called(filename) - - var r0 billy.File - if rf, ok := ret.Get(0).(func(string) billy.File); ok { - r0 = rf(filename) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(billy.File) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(filename) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Create indicates an expected call of Create. +func (mr *MockFSMockRecorder) Create(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockFS)(nil).Create), filename) } -// OpenFile provides a mock function with given fields: filename, flag, perm -func (_m *FS) OpenFile(filename string, flag int, perm iofs.FileMode) (billy.File, error) { - ret := _m.Called(filename, flag, perm) - - var r0 billy.File - if rf, ok := ret.Get(0).(func(string, int, iofs.FileMode) billy.File); ok { - r0 = rf(filename, flag, perm) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(billy.File) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, int, iofs.FileMode) error); ok { - r1 = rf(filename, flag, perm) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Exists mocks base method. +func (m *MockFS) Exists(path string) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Exists", path) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// ReadDir provides a mock function with given fields: path -func (_m *FS) ReadDir(path string) ([]iofs.FileInfo, error) { - ret := _m.Called(path) - - var r0 []iofs.FileInfo - if rf, ok := ret.Get(0).(func(string) []iofs.FileInfo); ok { - r0 = rf(path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]iofs.FileInfo) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Exists indicates an expected call of Exists. +func (mr *MockFSMockRecorder) Exists(path interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exists", reflect.TypeOf((*MockFS)(nil).Exists), path) } -// ReadFile provides a mock function with given fields: filename -func (_m *FS) ReadFile(filename string) ([]byte, error) { - ret := _m.Called(filename) +// ExistsOrDie mocks base method. +func (m *MockFS) ExistsOrDie(path string) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ExistsOrDie", path) + ret0, _ := ret[0].(bool) + return ret0 +} - var r0 []byte - if rf, ok := ret.Get(0).(func(string) []byte); ok { - r0 = rf(filename) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) - } - } +// ExistsOrDie indicates an expected call of ExistsOrDie. +func (mr *MockFSMockRecorder) ExistsOrDie(path interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExistsOrDie", reflect.TypeOf((*MockFS)(nil).ExistsOrDie), path) +} - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(filename) - } else { - r1 = ret.Error(1) +// Join mocks base method. +func (m *MockFS) Join(elem ...string) string { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range elem { + varargs = append(varargs, a) } + ret := m.ctrl.Call(m, "Join", varargs...) + ret0, _ := ret[0].(string) + return ret0 +} - return r0, r1 +// Join indicates an expected call of Join. +func (mr *MockFSMockRecorder) Join(elem ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Join", reflect.TypeOf((*MockFS)(nil).Join), elem...) } -// ReadJson provides a mock function with given fields: filename, o -func (_m *FS) ReadJson(filename string, o interface{}) error { - ret := _m.Called(filename, o) +// Lstat mocks base method. +func (m *MockFS) Lstat(filename string) (os.FileInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Lstat", filename) + ret0, _ := ret[0].(os.FileInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 error - if rf, ok := ret.Get(0).(func(string, interface{}) error); ok { - r0 = rf(filename, o) - } else { - r0 = ret.Error(0) - } +// Lstat indicates an expected call of Lstat. +func (mr *MockFSMockRecorder) Lstat(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lstat", reflect.TypeOf((*MockFS)(nil).Lstat), filename) +} - return r0 +// MkdirAll mocks base method. +func (m *MockFS) MkdirAll(filename string, perm os.FileMode) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MkdirAll", filename, perm) + ret0, _ := ret[0].(error) + return ret0 } -// ReadYamls provides a mock function with given fields: filename, o -func (_m *FS) ReadYamls(filename string, o ...interface{}) error { - var _ca []interface{} - _ca = append(_ca, filename) - _ca = append(_ca, o...) - ret := _m.Called(_ca...) +// MkdirAll indicates an expected call of MkdirAll. +func (mr *MockFSMockRecorder) MkdirAll(filename, perm interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MkdirAll", reflect.TypeOf((*MockFS)(nil).MkdirAll), filename, perm) +} - var r0 error - if rf, ok := ret.Get(0).(func(string, ...interface{}) error); ok { - r0 = rf(filename, o...) - } else { - r0 = ret.Error(0) - } +// Open mocks base method. +func (m *MockFS) Open(filename string) (billy.File, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Open", filename) + ret0, _ := ret[0].(billy.File) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 +// Open indicates an expected call of Open. +func (mr *MockFSMockRecorder) Open(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Open", reflect.TypeOf((*MockFS)(nil).Open), filename) } -// Readlink provides a mock function with given fields: link -func (_m *FS) Readlink(link string) (string, error) { - ret := _m.Called(link) +// OpenFile mocks base method. +func (m *MockFS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "OpenFile", filename, flag, perm) + ret0, _ := ret[0].(billy.File) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 string - if rf, ok := ret.Get(0).(func(string) string); ok { - r0 = rf(link) - } else { - r0 = ret.Get(0).(string) - } +// OpenFile indicates an expected call of OpenFile. +func (mr *MockFSMockRecorder) OpenFile(filename, flag, perm interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenFile", reflect.TypeOf((*MockFS)(nil).OpenFile), filename, flag, perm) +} - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(link) - } else { - r1 = ret.Error(1) - } +// ReadDir mocks base method. +func (m *MockFS) ReadDir(path string) ([]os.FileInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadDir", path) + ret0, _ := ret[0].([]os.FileInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 +// ReadDir indicates an expected call of ReadDir. +func (mr *MockFSMockRecorder) ReadDir(path interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadDir", reflect.TypeOf((*MockFS)(nil).ReadDir), path) } -// Remove provides a mock function with given fields: filename -func (_m *FS) Remove(filename string) error { - ret := _m.Called(filename) +// ReadFile mocks base method. +func (m *MockFS) ReadFile(filename string) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadFile", filename) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(filename) - } else { - r0 = ret.Error(0) - } +// ReadFile indicates an expected call of ReadFile. +func (mr *MockFSMockRecorder) ReadFile(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadFile", reflect.TypeOf((*MockFS)(nil).ReadFile), filename) +} - return r0 +// ReadJson mocks base method. +func (m *MockFS) ReadJson(filename string, o interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadJson", filename, o) + ret0, _ := ret[0].(error) + return ret0 } -// Rename provides a mock function with given fields: oldpath, newpath -func (_m *FS) Rename(oldpath string, newpath string) error { - ret := _m.Called(oldpath, newpath) +// ReadJson indicates an expected call of ReadJson. +func (mr *MockFSMockRecorder) ReadJson(filename, o interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadJson", reflect.TypeOf((*MockFS)(nil).ReadJson), filename, o) +} - var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(oldpath, newpath) - } else { - r0 = ret.Error(0) +// ReadYamls mocks base method. +func (m *MockFS) ReadYamls(filename string, o ...interface{}) error { + m.ctrl.T.Helper() + varargs := []interface{}{filename} + for _, a := range o { + varargs = append(varargs, a) } - - return r0 + ret := m.ctrl.Call(m, "ReadYamls", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Root provides a mock function with given fields: -func (_m *FS) Root() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } +// ReadYamls indicates an expected call of ReadYamls. +func (mr *MockFSMockRecorder) ReadYamls(filename interface{}, o ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{filename}, o...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadYamls", reflect.TypeOf((*MockFS)(nil).ReadYamls), varargs...) +} - return r0 +// Readlink mocks base method. +func (m *MockFS) Readlink(link string) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Readlink", link) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Stat provides a mock function with given fields: filename -func (_m *FS) Stat(filename string) (iofs.FileInfo, error) { - ret := _m.Called(filename) +// Readlink indicates an expected call of Readlink. +func (mr *MockFSMockRecorder) Readlink(link interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Readlink", reflect.TypeOf((*MockFS)(nil).Readlink), link) +} - var r0 iofs.FileInfo - if rf, ok := ret.Get(0).(func(string) iofs.FileInfo); ok { - r0 = rf(filename) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(iofs.FileInfo) - } - } +// Remove mocks base method. +func (m *MockFS) Remove(filename string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Remove", filename) + ret0, _ := ret[0].(error) + return ret0 +} - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(filename) - } else { - r1 = ret.Error(1) - } +// Remove indicates an expected call of Remove. +func (mr *MockFSMockRecorder) Remove(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockFS)(nil).Remove), filename) +} - return r0, r1 +// Rename mocks base method. +func (m *MockFS) Rename(oldpath, newpath string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Rename", oldpath, newpath) + ret0, _ := ret[0].(error) + return ret0 } -// Symlink provides a mock function with given fields: target, link -func (_m *FS) Symlink(target string, link string) error { - ret := _m.Called(target, link) +// Rename indicates an expected call of Rename. +func (mr *MockFSMockRecorder) Rename(oldpath, newpath interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rename", reflect.TypeOf((*MockFS)(nil).Rename), oldpath, newpath) +} - var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(target, link) - } else { - r0 = ret.Error(0) - } +// Root mocks base method. +func (m *MockFS) Root() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Root") + ret0, _ := ret[0].(string) + return ret0 +} - return r0 +// Root indicates an expected call of Root. +func (mr *MockFSMockRecorder) Root() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Root", reflect.TypeOf((*MockFS)(nil).Root)) } -// TempFile provides a mock function with given fields: dir, prefix -func (_m *FS) TempFile(dir string, prefix string) (billy.File, error) { - ret := _m.Called(dir, prefix) +// Stat mocks base method. +func (m *MockFS) Stat(filename string) (os.FileInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Stat", filename) + ret0, _ := ret[0].(os.FileInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 billy.File - if rf, ok := ret.Get(0).(func(string, string) billy.File); ok { - r0 = rf(dir, prefix) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(billy.File) - } - } +// Stat indicates an expected call of Stat. +func (mr *MockFSMockRecorder) Stat(filename interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stat", reflect.TypeOf((*MockFS)(nil).Stat), filename) +} - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(dir, prefix) - } else { - r1 = ret.Error(1) - } +// Symlink mocks base method. +func (m *MockFS) Symlink(target, link string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Symlink", target, link) + ret0, _ := ret[0].(error) + return ret0 +} - return r0, r1 +// Symlink indicates an expected call of Symlink. +func (mr *MockFSMockRecorder) Symlink(target, link interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Symlink", reflect.TypeOf((*MockFS)(nil).Symlink), target, link) } -// WriteJson provides a mock function with given fields: filename, o -func (_m *FS) WriteJson(filename string, o interface{}) error { - ret := _m.Called(filename, o) +// TempFile mocks base method. +func (m *MockFS) TempFile(dir, prefix string) (billy.File, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TempFile", dir, prefix) + ret0, _ := ret[0].(billy.File) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 error - if rf, ok := ret.Get(0).(func(string, interface{}) error); ok { - r0 = rf(filename, o) - } else { - r0 = ret.Error(0) - } +// TempFile indicates an expected call of TempFile. +func (mr *MockFSMockRecorder) TempFile(dir, prefix interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TempFile", reflect.TypeOf((*MockFS)(nil).TempFile), dir, prefix) +} - return r0 +// WriteJson mocks base method. +func (m *MockFS) WriteJson(filename string, o interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WriteJson", filename, o) + ret0, _ := ret[0].(error) + return ret0 } -// WriteYamls provides a mock function with given fields: filename, o -func (_m *FS) WriteYamls(filename string, o ...interface{}) error { - var _ca []interface{} - _ca = append(_ca, filename) - _ca = append(_ca, o...) - ret := _m.Called(_ca...) +// WriteJson indicates an expected call of WriteJson. +func (mr *MockFSMockRecorder) WriteJson(filename, o interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteJson", reflect.TypeOf((*MockFS)(nil).WriteJson), filename, o) +} - var r0 error - if rf, ok := ret.Get(0).(func(string, ...interface{}) error); ok { - r0 = rf(filename, o...) - } else { - r0 = ret.Error(0) +// WriteYamls mocks base method. +func (m *MockFS) WriteYamls(filename string, o ...interface{}) error { + m.ctrl.T.Helper() + varargs := []interface{}{filename} + for _, a := range o { + varargs = append(varargs, a) } + ret := m.ctrl.Call(m, "WriteYamls", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} - return r0 +// WriteYamls indicates an expected call of WriteYamls. +func (mr *MockFSMockRecorder) WriteYamls(filename interface{}, o ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{filename}, o...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteYamls", reflect.TypeOf((*MockFS)(nil).WriteYamls), varargs...) } diff --git a/pkg/git/ado/mocks/ado.go b/pkg/git/ado/mocks/ado.go new file mode 100644 index 00000000..037a1f06 --- /dev/null +++ b/pkg/git/ado/mocks/ado.go @@ -0,0 +1,88 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./provider_ado.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + git "github.com/microsoft/azure-devops-go-api/azuredevops/git" +) + +// MockAdoClient is a mock of AdoClient interface. +type MockAdoClient struct { + ctrl *gomock.Controller + recorder *MockAdoClientMockRecorder +} + +// MockAdoClientMockRecorder is the mock recorder for MockAdoClient. +type MockAdoClientMockRecorder struct { + mock *MockAdoClient +} + +// NewMockAdoClient creates a new mock instance. +func NewMockAdoClient(ctrl *gomock.Controller) *MockAdoClient { + mock := &MockAdoClient{ctrl: ctrl} + mock.recorder = &MockAdoClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAdoClient) EXPECT() *MockAdoClientMockRecorder { + return m.recorder +} + +// CreateRepository mocks base method. +func (m *MockAdoClient) CreateRepository(arg0 context.Context, arg1 git.CreateRepositoryArgs) (*git.GitRepository, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRepository", arg0, arg1) + ret0, _ := ret[0].(*git.GitRepository) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRepository indicates an expected call of CreateRepository. +func (mr *MockAdoClientMockRecorder) CreateRepository(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRepository", reflect.TypeOf((*MockAdoClient)(nil).CreateRepository), arg0, arg1) +} + +// MockAdoUrl is a mock of AdoUrl interface. +type MockAdoUrl struct { + ctrl *gomock.Controller + recorder *MockAdoUrlMockRecorder +} + +// MockAdoUrlMockRecorder is the mock recorder for MockAdoUrl. +type MockAdoUrlMockRecorder struct { + mock *MockAdoUrl +} + +// NewMockAdoUrl creates a new mock instance. +func NewMockAdoUrl(ctrl *gomock.Controller) *MockAdoUrl { + mock := &MockAdoUrl{ctrl: ctrl} + mock.recorder = &MockAdoUrlMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAdoUrl) EXPECT() *MockAdoUrlMockRecorder { + return m.recorder +} + +// GetProjectName mocks base method. +func (m *MockAdoUrl) GetProjectName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetProjectName") + ret0, _ := ret[0].(string) + return ret0 +} + +// GetProjectName indicates an expected call of GetProjectName. +func (mr *MockAdoUrlMockRecorder) GetProjectName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProjectName", reflect.TypeOf((*MockAdoUrl)(nil).GetProjectName)) +} diff --git a/pkg/git/ado/mocks/ado_client.go b/pkg/git/ado/mocks/ado_client.go deleted file mode 100644 index 0ae56874..00000000 --- a/pkg/git/ado/mocks/ado_client.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import ( - context "context" - - git "github.com/microsoft/azure-devops-go-api/azuredevops/git" - mock "github.com/stretchr/testify/mock" -) - -// AdoClient is an autogenerated mock type for the AdoClient type -type AdoClient struct { - mock.Mock -} - -// CreateRepository provides a mock function with given fields: _a0, _a1 -func (_m *AdoClient) CreateRepository(_a0 context.Context, _a1 git.CreateRepositoryArgs) (*git.GitRepository, error) { - ret := _m.Called(_a0, _a1) - - var r0 *git.GitRepository - if rf, ok := ret.Get(0).(func(context.Context, git.CreateRepositoryArgs) *git.GitRepository); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.GitRepository) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, git.CreateRepositoryArgs) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/pkg/git/ado/mocks/ado_url.go b/pkg/git/ado/mocks/ado_url.go deleted file mode 100644 index 8da85743..00000000 --- a/pkg/git/ado/mocks/ado_url.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// AdoUrl is an autogenerated mock type for the AdoUrl type -type AdoUrl struct { - mock.Mock -} - -// GetProjectName provides a mock function with given fields: -func (_m *AdoUrl) GetProjectName() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} diff --git a/pkg/git/gitea/mocks/client.go b/pkg/git/gitea/mocks/client.go index fc5a28a0..f6976bab 100644 --- a/pkg/git/gitea/mocks/client.go +++ b/pkg/git/gitea/mocks/client.go @@ -1,109 +1,83 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./provider_gitea.go +// Package mocks is a generated GoMock package. package mocks import ( + reflect "reflect" + gitea "code.gitea.io/sdk/gitea" - mock "github.com/stretchr/testify/mock" + gomock "github.com/golang/mock/gomock" ) -// Client is an autogenerated mock type for the Client type -type Client struct { - mock.Mock +// MockClient is a mock of Client interface. +type MockClient struct { + ctrl *gomock.Controller + recorder *MockClientMockRecorder } -// CreateOrgRepo provides a mock function with given fields: org, opt -func (_m *Client) CreateOrgRepo(org string, opt gitea.CreateRepoOption) (*gitea.Repository, *gitea.Response, error) { - ret := _m.Called(org, opt) - - var r0 *gitea.Repository - if rf, ok := ret.Get(0).(func(string, gitea.CreateRepoOption) *gitea.Repository); ok { - r0 = rf(org, opt) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*gitea.Repository) - } - } - - var r1 *gitea.Response - if rf, ok := ret.Get(1).(func(string, gitea.CreateRepoOption) *gitea.Response); ok { - r1 = rf(org, opt) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitea.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(string, gitea.CreateRepoOption) error); ok { - r2 = rf(org, opt) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 +// MockClientMockRecorder is the mock recorder for MockClient. +type MockClientMockRecorder struct { + mock *MockClient } -// CreateRepo provides a mock function with given fields: opt -func (_m *Client) CreateRepo(opt gitea.CreateRepoOption) (*gitea.Repository, *gitea.Response, error) { - ret := _m.Called(opt) - - var r0 *gitea.Repository - if rf, ok := ret.Get(0).(func(gitea.CreateRepoOption) *gitea.Repository); ok { - r0 = rf(opt) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*gitea.Repository) - } - } - - var r1 *gitea.Response - if rf, ok := ret.Get(1).(func(gitea.CreateRepoOption) *gitea.Response); ok { - r1 = rf(opt) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitea.Response) - } - } +// NewMockClient creates a new mock instance. +func NewMockClient(ctrl *gomock.Controller) *MockClient { + mock := &MockClient{ctrl: ctrl} + mock.recorder = &MockClientMockRecorder{mock} + return mock +} - var r2 error - if rf, ok := ret.Get(2).(func(gitea.CreateRepoOption) error); ok { - r2 = rf(opt) - } else { - r2 = ret.Error(2) - } +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockClient) EXPECT() *MockClientMockRecorder { + return m.recorder +} - return r0, r1, r2 +// CreateOrgRepo mocks base method. +func (m *MockClient) CreateOrgRepo(org string, opt gitea.CreateRepoOption) (*gitea.Repository, *gitea.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrgRepo", org, opt) + ret0, _ := ret[0].(*gitea.Repository) + ret1, _ := ret[1].(*gitea.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// GetMyUserInfo provides a mock function with given fields: -func (_m *Client) GetMyUserInfo() (*gitea.User, *gitea.Response, error) { - ret := _m.Called() +// CreateOrgRepo indicates an expected call of CreateOrgRepo. +func (mr *MockClientMockRecorder) CreateOrgRepo(org, opt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrgRepo", reflect.TypeOf((*MockClient)(nil).CreateOrgRepo), org, opt) +} - var r0 *gitea.User - if rf, ok := ret.Get(0).(func() *gitea.User); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*gitea.User) - } - } +// CreateRepo mocks base method. +func (m *MockClient) CreateRepo(opt gitea.CreateRepoOption) (*gitea.Repository, *gitea.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRepo", opt) + ret0, _ := ret[0].(*gitea.Repository) + ret1, _ := ret[1].(*gitea.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} - var r1 *gitea.Response - if rf, ok := ret.Get(1).(func() *gitea.Response); ok { - r1 = rf() - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitea.Response) - } - } +// CreateRepo indicates an expected call of CreateRepo. +func (mr *MockClientMockRecorder) CreateRepo(opt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRepo", reflect.TypeOf((*MockClient)(nil).CreateRepo), opt) +} - var r2 error - if rf, ok := ret.Get(2).(func() error); ok { - r2 = rf() - } else { - r2 = ret.Error(2) - } +// GetMyUserInfo mocks base method. +func (m *MockClient) GetMyUserInfo() (*gitea.User, *gitea.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMyUserInfo") + ret0, _ := ret[0].(*gitea.User) + ret1, _ := ret[1].(*gitea.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} - return r0, r1, r2 +// GetMyUserInfo indicates an expected call of GetMyUserInfo. +func (mr *MockClientMockRecorder) GetMyUserInfo() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMyUserInfo", reflect.TypeOf((*MockClient)(nil).GetMyUserInfo)) } diff --git a/pkg/git/github/mocks/organizations.go b/pkg/git/github/mocks/organizations.go deleted file mode 100644 index 3427e8fe..00000000 --- a/pkg/git/github/mocks/organizations.go +++ /dev/null @@ -1,1200 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import ( - context "context" - - github "github.com/google/go-github/v35/github" - - mock "github.com/stretchr/testify/mock" -) - -// Organizations is an autogenerated mock type for the Organizations type -type Organizations struct { - mock.Mock -} - -// BlockUser provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) BlockUser(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConcealMembership provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ConcealMembership(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConvertMemberToOutsideCollaborator provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ConvertMemberToOutsideCollaborator(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateHook provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) CreateHook(_a0 context.Context, _a1 string, _a2 *github.Hook) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, *github.Hook) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.Hook) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.Hook) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateOrgInvitation provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) CreateOrgInvitation(_a0 context.Context, _a1 string, _a2 *github.CreateOrgInvitationOptions) (*github.Invitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Invitation - if rf, ok := ret.Get(0).(func(context.Context, string, *github.CreateOrgInvitationOptions) *github.Invitation); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Invitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.CreateOrgInvitationOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.CreateOrgInvitationOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateProject provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) CreateProject(_a0 context.Context, _a1 string, _a2 *github.ProjectOptions) (*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Project - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ProjectOptions) *github.Project); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ProjectOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ProjectOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DeleteHook provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) DeleteHook(_a0 context.Context, _a1 string, _a2 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Edit provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) Edit(_a0 context.Context, _a1 string, _a2 *github.Organization) (*github.Organization, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Organization - if rf, ok := ret.Get(0).(func(context.Context, string, *github.Organization) *github.Organization); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Organization) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.Organization) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.Organization) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditActionsAllowed provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) EditActionsAllowed(_a0 context.Context, _a1 string, _a2 github.ActionsAllowed) (*github.ActionsAllowed, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.ActionsAllowed - if rf, ok := ret.Get(0).(func(context.Context, string, github.ActionsAllowed) *github.ActionsAllowed); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ActionsAllowed) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, github.ActionsAllowed) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, github.ActionsAllowed) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditActionsPermissions provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) EditActionsPermissions(_a0 context.Context, _a1 string, _a2 github.ActionsPermissions) (*github.ActionsPermissions, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.ActionsPermissions - if rf, ok := ret.Get(0).(func(context.Context, string, github.ActionsPermissions) *github.ActionsPermissions); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ActionsPermissions) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, github.ActionsPermissions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, github.ActionsPermissions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Organizations) EditHook(_a0 context.Context, _a1 string, _a2 int64, _a3 *github.Hook) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, int64, *github.Hook) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, int64, *github.Hook) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, int64, *github.Hook) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditOrgMembership provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Organizations) EditOrgMembership(_a0 context.Context, _a1 string, _a2 string, _a3 *github.Membership) (*github.Membership, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Membership - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.Membership) *github.Membership); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Membership) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.Membership) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.Membership) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Get provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) Get(_a0 context.Context, _a1 string) (*github.Organization, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Organization - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Organization); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Organization) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetActionsAllowed provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) GetActionsAllowed(_a0 context.Context, _a1 string) (*github.ActionsAllowed, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.ActionsAllowed - if rf, ok := ret.Get(0).(func(context.Context, string) *github.ActionsAllowed); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ActionsAllowed) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetActionsPermissions provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) GetActionsPermissions(_a0 context.Context, _a1 string) (*github.ActionsPermissions, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.ActionsPermissions - if rf, ok := ret.Get(0).(func(context.Context, string) *github.ActionsPermissions); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ActionsPermissions) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetAuditLog provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) GetAuditLog(_a0 context.Context, _a1 string, _a2 *github.GetAuditLogOptions) ([]*github.AuditEntry, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.AuditEntry - if rf, ok := ret.Get(0).(func(context.Context, string, *github.GetAuditLogOptions) []*github.AuditEntry); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.AuditEntry) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.GetAuditLogOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.GetAuditLogOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetByID provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) GetByID(_a0 context.Context, _a1 int64) (*github.Organization, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Organization - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Organization); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Organization) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, int64) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, int64) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetHook provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) GetHook(_a0 context.Context, _a1 string, _a2 int64) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, int64) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetOrgMembership provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) GetOrgMembership(_a0 context.Context, _a1 string, _a2 string) (*github.Membership, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Membership - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Membership); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Membership) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsBlocked provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) IsBlocked(_a0 context.Context, _a1 string, _a2 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsMember provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) IsMember(_a0 context.Context, _a1 string, _a2 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsPublicMember provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) IsPublicMember(_a0 context.Context, _a1 string, _a2 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// List provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) List(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.Organization, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Organization - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.Organization); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Organization) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListAll provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) ListAll(_a0 context.Context, _a1 *github.OrganizationsListOptions) ([]*github.Organization, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.Organization - if rf, ok := ret.Get(0).(func(context.Context, *github.OrganizationsListOptions) []*github.Organization); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Organization) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.OrganizationsListOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.OrganizationsListOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListBlockedUsers provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListBlockedUsers(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListFailedOrgInvitations provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListFailedOrgInvitations(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.Invitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Invitation - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.Invitation); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Invitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListHooks provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListHooks(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.Hook); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListInstallations provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListInstallations(_a0 context.Context, _a1 string, _a2 *github.ListOptions) (*github.OrganizationInstallations, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.OrganizationInstallations - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) *github.OrganizationInstallations); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.OrganizationInstallations) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListMembers provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListMembers(_a0 context.Context, _a1 string, _a2 *github.ListMembersOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListMembersOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListMembersOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListMembersOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListOrgInvitationTeams provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Organizations) ListOrgInvitationTeams(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.Team, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Team - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.Team); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Team) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListOrgMemberships provides a mock function with given fields: _a0, _a1 -func (_m *Organizations) ListOrgMemberships(_a0 context.Context, _a1 *github.ListOrgMembershipsOptions) ([]*github.Membership, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.Membership - if rf, ok := ret.Get(0).(func(context.Context, *github.ListOrgMembershipsOptions) []*github.Membership); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Membership) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.ListOrgMembershipsOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.ListOrgMembershipsOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListOutsideCollaborators provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListOutsideCollaborators(_a0 context.Context, _a1 string, _a2 *github.ListOutsideCollaboratorsOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOutsideCollaboratorsOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOutsideCollaboratorsOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOutsideCollaboratorsOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListPendingOrgInvitations provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListPendingOrgInvitations(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.Invitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Invitation - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.Invitation); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Invitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListProjects provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) ListProjects(_a0 context.Context, _a1 string, _a2 *github.ProjectListOptions) ([]*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Project - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ProjectListOptions) []*github.Project); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ProjectListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ProjectListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// PingHook provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) PingHook(_a0 context.Context, _a1 string, _a2 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// PublicizeMembership provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) PublicizeMembership(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveMember provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) RemoveMember(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveOrgMembership provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) RemoveOrgMembership(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveOutsideCollaborator provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) RemoveOutsideCollaborator(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UnblockUser provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Organizations) UnblockUser(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/pkg/git/github/mocks/repos.go b/pkg/git/github/mocks/repos.go new file mode 100644 index 00000000..fe2f41d0 --- /dev/null +++ b/pkg/git/github/mocks/repos.go @@ -0,0 +1,2274 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./github/repos.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + io "io" + http "net/http" + url "net/url" + os "os" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + github "github.com/google/go-github/v35/github" +) + +// MockRepositories is a mock of Repositories interface. +type MockRepositories struct { + ctrl *gomock.Controller + recorder *MockRepositoriesMockRecorder +} + +// MockRepositoriesMockRecorder is the mock recorder for MockRepositories. +type MockRepositoriesMockRecorder struct { + mock *MockRepositories +} + +// NewMockRepositories creates a new mock instance. +func NewMockRepositories(ctrl *gomock.Controller) *MockRepositories { + mock := &MockRepositories{ctrl: ctrl} + mock.recorder = &MockRepositoriesMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRepositories) EXPECT() *MockRepositoriesMockRecorder { + return m.recorder +} + +// AddAdminEnforcement mocks base method. +func (m *MockRepositories) AddAdminEnforcement(arg0 context.Context, arg1, arg2, arg3 string) (*github.AdminEnforcement, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddAdminEnforcement", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.AdminEnforcement) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// AddAdminEnforcement indicates an expected call of AddAdminEnforcement. +func (mr *MockRepositoriesMockRecorder) AddAdminEnforcement(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAdminEnforcement", reflect.TypeOf((*MockRepositories)(nil).AddAdminEnforcement), arg0, arg1, arg2, arg3) +} + +// AddAppRestrictions mocks base method. +func (m *MockRepositories) AddAppRestrictions(arg0 context.Context, arg1, arg2, arg3 string, arg4 []string) ([]*github.App, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddAppRestrictions", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.App) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// AddAppRestrictions indicates an expected call of AddAppRestrictions. +func (mr *MockRepositoriesMockRecorder) AddAppRestrictions(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAppRestrictions", reflect.TypeOf((*MockRepositories)(nil).AddAppRestrictions), arg0, arg1, arg2, arg3, arg4) +} + +// AddCollaborator mocks base method. +func (m *MockRepositories) AddCollaborator(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryAddCollaboratorOptions) (*github.CollaboratorInvitation, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddCollaborator", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.CollaboratorInvitation) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// AddCollaborator indicates an expected call of AddCollaborator. +func (mr *MockRepositoriesMockRecorder) AddCollaborator(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddCollaborator", reflect.TypeOf((*MockRepositories)(nil).AddCollaborator), arg0, arg1, arg2, arg3, arg4) +} + +// CompareCommits mocks base method. +func (m *MockRepositories) CompareCommits(arg0 context.Context, arg1, arg2, arg3, arg4 string) (*github.CommitsComparison, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CompareCommits", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.CommitsComparison) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CompareCommits indicates an expected call of CompareCommits. +func (mr *MockRepositoriesMockRecorder) CompareCommits(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompareCommits", reflect.TypeOf((*MockRepositories)(nil).CompareCommits), arg0, arg1, arg2, arg3, arg4) +} + +// CompareCommitsRaw mocks base method. +func (m *MockRepositories) CompareCommitsRaw(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5 github.RawOptions) (string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CompareCommitsRaw", arg0, arg1, arg2, arg3, arg4, arg5) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CompareCommitsRaw indicates an expected call of CompareCommitsRaw. +func (mr *MockRepositoriesMockRecorder) CompareCommitsRaw(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompareCommitsRaw", reflect.TypeOf((*MockRepositories)(nil).CompareCommitsRaw), arg0, arg1, arg2, arg3, arg4, arg5) +} + +// Create mocks base method. +func (m *MockRepositories) Create(arg0 context.Context, arg1 string, arg2 *github.Repository) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Create indicates an expected call of Create. +func (mr *MockRepositoriesMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockRepositories)(nil).Create), arg0, arg1, arg2) +} + +// CreateComment mocks base method. +func (m *MockRepositories) CreateComment(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateComment", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryComment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateComment indicates an expected call of CreateComment. +func (mr *MockRepositoriesMockRecorder) CreateComment(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateComment", reflect.TypeOf((*MockRepositories)(nil).CreateComment), arg0, arg1, arg2, arg3, arg4) +} + +// CreateDeployment mocks base method. +func (m *MockRepositories) CreateDeployment(arg0 context.Context, arg1, arg2 string, arg3 *github.DeploymentRequest) (*github.Deployment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateDeployment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Deployment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateDeployment indicates an expected call of CreateDeployment. +func (mr *MockRepositoriesMockRecorder) CreateDeployment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDeployment", reflect.TypeOf((*MockRepositories)(nil).CreateDeployment), arg0, arg1, arg2, arg3) +} + +// CreateDeploymentStatus mocks base method. +func (m *MockRepositories) CreateDeploymentStatus(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.DeploymentStatusRequest) (*github.DeploymentStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateDeploymentStatus", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.DeploymentStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateDeploymentStatus indicates an expected call of CreateDeploymentStatus. +func (mr *MockRepositoriesMockRecorder) CreateDeploymentStatus(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDeploymentStatus", reflect.TypeOf((*MockRepositories)(nil).CreateDeploymentStatus), arg0, arg1, arg2, arg3, arg4) +} + +// CreateFile mocks base method. +func (m *MockRepositories) CreateFile(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateFile", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryContentResponse) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateFile indicates an expected call of CreateFile. +func (mr *MockRepositoriesMockRecorder) CreateFile(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFile", reflect.TypeOf((*MockRepositories)(nil).CreateFile), arg0, arg1, arg2, arg3, arg4) +} + +// CreateFork mocks base method. +func (m *MockRepositories) CreateFork(arg0 context.Context, arg1, arg2 string, arg3 *github.RepositoryCreateForkOptions) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateFork", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateFork indicates an expected call of CreateFork. +func (mr *MockRepositoriesMockRecorder) CreateFork(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFork", reflect.TypeOf((*MockRepositories)(nil).CreateFork), arg0, arg1, arg2, arg3) +} + +// CreateFromTemplate mocks base method. +func (m *MockRepositories) CreateFromTemplate(arg0 context.Context, arg1, arg2 string, arg3 *github.TemplateRepoRequest) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateFromTemplate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateFromTemplate indicates an expected call of CreateFromTemplate. +func (mr *MockRepositoriesMockRecorder) CreateFromTemplate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFromTemplate", reflect.TypeOf((*MockRepositories)(nil).CreateFromTemplate), arg0, arg1, arg2, arg3) +} + +// CreateHook mocks base method. +func (m *MockRepositories) CreateHook(arg0 context.Context, arg1, arg2 string, arg3 *github.Hook) (*github.Hook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Hook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateHook indicates an expected call of CreateHook. +func (mr *MockRepositoriesMockRecorder) CreateHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHook", reflect.TypeOf((*MockRepositories)(nil).CreateHook), arg0, arg1, arg2, arg3) +} + +// CreateKey mocks base method. +func (m *MockRepositories) CreateKey(arg0 context.Context, arg1, arg2 string, arg3 *github.Key) (*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateKey", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateKey indicates an expected call of CreateKey. +func (mr *MockRepositoriesMockRecorder) CreateKey(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateKey", reflect.TypeOf((*MockRepositories)(nil).CreateKey), arg0, arg1, arg2, arg3) +} + +// CreateProject mocks base method. +func (m *MockRepositories) CreateProject(arg0 context.Context, arg1, arg2 string, arg3 *github.ProjectOptions) (*github.Project, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateProject", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Project) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateProject indicates an expected call of CreateProject. +func (mr *MockRepositoriesMockRecorder) CreateProject(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProject", reflect.TypeOf((*MockRepositories)(nil).CreateProject), arg0, arg1, arg2, arg3) +} + +// CreateRelease mocks base method. +func (m *MockRepositories) CreateRelease(arg0 context.Context, arg1, arg2 string, arg3 *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRelease", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateRelease indicates an expected call of CreateRelease. +func (mr *MockRepositoriesMockRecorder) CreateRelease(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRelease", reflect.TypeOf((*MockRepositories)(nil).CreateRelease), arg0, arg1, arg2, arg3) +} + +// CreateStatus mocks base method. +func (m *MockRepositories) CreateStatus(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepoStatus) (*github.RepoStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStatus", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepoStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateStatus indicates an expected call of CreateStatus. +func (mr *MockRepositoriesMockRecorder) CreateStatus(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStatus", reflect.TypeOf((*MockRepositories)(nil).CreateStatus), arg0, arg1, arg2, arg3, arg4) +} + +// CreateUpdateEnvironment mocks base method. +func (m *MockRepositories) CreateUpdateEnvironment(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.CreateUpdateEnvironment) (*github.Environment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateUpdateEnvironment", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.Environment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateUpdateEnvironment indicates an expected call of CreateUpdateEnvironment. +func (mr *MockRepositoriesMockRecorder) CreateUpdateEnvironment(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUpdateEnvironment", reflect.TypeOf((*MockRepositories)(nil).CreateUpdateEnvironment), arg0, arg1, arg2, arg3, arg4) +} + +// Delete mocks base method. +func (m *MockRepositories) Delete(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Delete indicates an expected call of Delete. +func (mr *MockRepositoriesMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRepositories)(nil).Delete), arg0, arg1, arg2) +} + +// DeleteComment mocks base method. +func (m *MockRepositories) DeleteComment(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteComment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteComment indicates an expected call of DeleteComment. +func (mr *MockRepositoriesMockRecorder) DeleteComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteComment", reflect.TypeOf((*MockRepositories)(nil).DeleteComment), arg0, arg1, arg2, arg3) +} + +// DeleteDeployment mocks base method. +func (m *MockRepositories) DeleteDeployment(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteDeployment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteDeployment indicates an expected call of DeleteDeployment. +func (mr *MockRepositoriesMockRecorder) DeleteDeployment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDeployment", reflect.TypeOf((*MockRepositories)(nil).DeleteDeployment), arg0, arg1, arg2, arg3) +} + +// DeleteEnvironment mocks base method. +func (m *MockRepositories) DeleteEnvironment(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteEnvironment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteEnvironment indicates an expected call of DeleteEnvironment. +func (mr *MockRepositoriesMockRecorder) DeleteEnvironment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteEnvironment", reflect.TypeOf((*MockRepositories)(nil).DeleteEnvironment), arg0, arg1, arg2, arg3) +} + +// DeleteFile mocks base method. +func (m *MockRepositories) DeleteFile(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteFile", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryContentResponse) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// DeleteFile indicates an expected call of DeleteFile. +func (mr *MockRepositoriesMockRecorder) DeleteFile(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFile", reflect.TypeOf((*MockRepositories)(nil).DeleteFile), arg0, arg1, arg2, arg3, arg4) +} + +// DeleteHook mocks base method. +func (m *MockRepositories) DeleteHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteHook indicates an expected call of DeleteHook. +func (mr *MockRepositoriesMockRecorder) DeleteHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteHook", reflect.TypeOf((*MockRepositories)(nil).DeleteHook), arg0, arg1, arg2, arg3) +} + +// DeleteInvitation mocks base method. +func (m *MockRepositories) DeleteInvitation(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteInvitation", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteInvitation indicates an expected call of DeleteInvitation. +func (mr *MockRepositoriesMockRecorder) DeleteInvitation(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInvitation", reflect.TypeOf((*MockRepositories)(nil).DeleteInvitation), arg0, arg1, arg2, arg3) +} + +// DeleteKey mocks base method. +func (m *MockRepositories) DeleteKey(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteKey", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteKey indicates an expected call of DeleteKey. +func (mr *MockRepositoriesMockRecorder) DeleteKey(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteKey", reflect.TypeOf((*MockRepositories)(nil).DeleteKey), arg0, arg1, arg2, arg3) +} + +// DeletePreReceiveHook mocks base method. +func (m *MockRepositories) DeletePreReceiveHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePreReceiveHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePreReceiveHook indicates an expected call of DeletePreReceiveHook. +func (mr *MockRepositoriesMockRecorder) DeletePreReceiveHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePreReceiveHook", reflect.TypeOf((*MockRepositories)(nil).DeletePreReceiveHook), arg0, arg1, arg2, arg3) +} + +// DeleteRelease mocks base method. +func (m *MockRepositories) DeleteRelease(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRelease", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRelease indicates an expected call of DeleteRelease. +func (mr *MockRepositoriesMockRecorder) DeleteRelease(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRelease", reflect.TypeOf((*MockRepositories)(nil).DeleteRelease), arg0, arg1, arg2, arg3) +} + +// DeleteReleaseAsset mocks base method. +func (m *MockRepositories) DeleteReleaseAsset(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteReleaseAsset", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteReleaseAsset indicates an expected call of DeleteReleaseAsset. +func (mr *MockRepositoriesMockRecorder) DeleteReleaseAsset(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteReleaseAsset", reflect.TypeOf((*MockRepositories)(nil).DeleteReleaseAsset), arg0, arg1, arg2, arg3) +} + +// DisableAutomatedSecurityFixes mocks base method. +func (m *MockRepositories) DisableAutomatedSecurityFixes(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DisableAutomatedSecurityFixes", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DisableAutomatedSecurityFixes indicates an expected call of DisableAutomatedSecurityFixes. +func (mr *MockRepositoriesMockRecorder) DisableAutomatedSecurityFixes(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisableAutomatedSecurityFixes", reflect.TypeOf((*MockRepositories)(nil).DisableAutomatedSecurityFixes), arg0, arg1, arg2) +} + +// DisableDismissalRestrictions mocks base method. +func (m *MockRepositories) DisableDismissalRestrictions(arg0 context.Context, arg1, arg2, arg3 string) (*github.PullRequestReviewsEnforcement, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DisableDismissalRestrictions", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.PullRequestReviewsEnforcement) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// DisableDismissalRestrictions indicates an expected call of DisableDismissalRestrictions. +func (mr *MockRepositoriesMockRecorder) DisableDismissalRestrictions(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisableDismissalRestrictions", reflect.TypeOf((*MockRepositories)(nil).DisableDismissalRestrictions), arg0, arg1, arg2, arg3) +} + +// DisablePages mocks base method. +func (m *MockRepositories) DisablePages(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DisablePages", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DisablePages indicates an expected call of DisablePages. +func (mr *MockRepositoriesMockRecorder) DisablePages(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisablePages", reflect.TypeOf((*MockRepositories)(nil).DisablePages), arg0, arg1, arg2) +} + +// DisableVulnerabilityAlerts mocks base method. +func (m *MockRepositories) DisableVulnerabilityAlerts(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DisableVulnerabilityAlerts", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DisableVulnerabilityAlerts indicates an expected call of DisableVulnerabilityAlerts. +func (mr *MockRepositoriesMockRecorder) DisableVulnerabilityAlerts(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisableVulnerabilityAlerts", reflect.TypeOf((*MockRepositories)(nil).DisableVulnerabilityAlerts), arg0, arg1, arg2) +} + +// Dispatch mocks base method. +func (m *MockRepositories) Dispatch(arg0 context.Context, arg1, arg2 string, arg3 github.DispatchRequestOptions) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Dispatch", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Dispatch indicates an expected call of Dispatch. +func (mr *MockRepositoriesMockRecorder) Dispatch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dispatch", reflect.TypeOf((*MockRepositories)(nil).Dispatch), arg0, arg1, arg2, arg3) +} + +// DownloadContents mocks base method. +func (m *MockRepositories) DownloadContents(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentGetOptions) (io.ReadCloser, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DownloadContents", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// DownloadContents indicates an expected call of DownloadContents. +func (mr *MockRepositoriesMockRecorder) DownloadContents(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadContents", reflect.TypeOf((*MockRepositories)(nil).DownloadContents), arg0, arg1, arg2, arg3, arg4) +} + +// DownloadContentsWithMeta mocks base method. +func (m *MockRepositories) DownloadContentsWithMeta(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentGetOptions) (io.ReadCloser, *github.RepositoryContent, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DownloadContentsWithMeta", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(*github.RepositoryContent) + ret2, _ := ret[2].(*github.Response) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 +} + +// DownloadContentsWithMeta indicates an expected call of DownloadContentsWithMeta. +func (mr *MockRepositoriesMockRecorder) DownloadContentsWithMeta(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadContentsWithMeta", reflect.TypeOf((*MockRepositories)(nil).DownloadContentsWithMeta), arg0, arg1, arg2, arg3, arg4) +} + +// DownloadReleaseAsset mocks base method. +func (m *MockRepositories) DownloadReleaseAsset(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *http.Client) (io.ReadCloser, string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DownloadReleaseAsset", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(string) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// DownloadReleaseAsset indicates an expected call of DownloadReleaseAsset. +func (mr *MockRepositoriesMockRecorder) DownloadReleaseAsset(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadReleaseAsset", reflect.TypeOf((*MockRepositories)(nil).DownloadReleaseAsset), arg0, arg1, arg2, arg3, arg4) +} + +// Edit mocks base method. +func (m *MockRepositories) Edit(arg0 context.Context, arg1, arg2 string, arg3 *github.Repository) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Edit", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Edit indicates an expected call of Edit. +func (mr *MockRepositoriesMockRecorder) Edit(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Edit", reflect.TypeOf((*MockRepositories)(nil).Edit), arg0, arg1, arg2, arg3) +} + +// EditHook mocks base method. +func (m *MockRepositories) EditHook(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.Hook) (*github.Hook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EditHook", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.Hook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// EditHook indicates an expected call of EditHook. +func (mr *MockRepositoriesMockRecorder) EditHook(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EditHook", reflect.TypeOf((*MockRepositories)(nil).EditHook), arg0, arg1, arg2, arg3, arg4) +} + +// EditRelease mocks base method. +func (m *MockRepositories) EditRelease(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EditRelease", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// EditRelease indicates an expected call of EditRelease. +func (mr *MockRepositoriesMockRecorder) EditRelease(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EditRelease", reflect.TypeOf((*MockRepositories)(nil).EditRelease), arg0, arg1, arg2, arg3, arg4) +} + +// EditReleaseAsset mocks base method. +func (m *MockRepositories) EditReleaseAsset(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.ReleaseAsset) (*github.ReleaseAsset, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EditReleaseAsset", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.ReleaseAsset) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// EditReleaseAsset indicates an expected call of EditReleaseAsset. +func (mr *MockRepositoriesMockRecorder) EditReleaseAsset(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EditReleaseAsset", reflect.TypeOf((*MockRepositories)(nil).EditReleaseAsset), arg0, arg1, arg2, arg3, arg4) +} + +// EnableAutomatedSecurityFixes mocks base method. +func (m *MockRepositories) EnableAutomatedSecurityFixes(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnableAutomatedSecurityFixes", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EnableAutomatedSecurityFixes indicates an expected call of EnableAutomatedSecurityFixes. +func (mr *MockRepositoriesMockRecorder) EnableAutomatedSecurityFixes(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableAutomatedSecurityFixes", reflect.TypeOf((*MockRepositories)(nil).EnableAutomatedSecurityFixes), arg0, arg1, arg2) +} + +// EnablePages mocks base method. +func (m *MockRepositories) EnablePages(arg0 context.Context, arg1, arg2 string, arg3 *github.Pages) (*github.Pages, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnablePages", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Pages) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// EnablePages indicates an expected call of EnablePages. +func (mr *MockRepositoriesMockRecorder) EnablePages(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnablePages", reflect.TypeOf((*MockRepositories)(nil).EnablePages), arg0, arg1, arg2, arg3) +} + +// EnableVulnerabilityAlerts mocks base method. +func (m *MockRepositories) EnableVulnerabilityAlerts(arg0 context.Context, arg1, arg2 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnableVulnerabilityAlerts", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EnableVulnerabilityAlerts indicates an expected call of EnableVulnerabilityAlerts. +func (mr *MockRepositoriesMockRecorder) EnableVulnerabilityAlerts(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableVulnerabilityAlerts", reflect.TypeOf((*MockRepositories)(nil).EnableVulnerabilityAlerts), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockRepositories) Get(arg0 context.Context, arg1, arg2 string) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Get indicates an expected call of Get. +func (mr *MockRepositoriesMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepositories)(nil).Get), arg0, arg1, arg2) +} + +// GetAdminEnforcement mocks base method. +func (m *MockRepositories) GetAdminEnforcement(arg0 context.Context, arg1, arg2, arg3 string) (*github.AdminEnforcement, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAdminEnforcement", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.AdminEnforcement) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetAdminEnforcement indicates an expected call of GetAdminEnforcement. +func (mr *MockRepositoriesMockRecorder) GetAdminEnforcement(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAdminEnforcement", reflect.TypeOf((*MockRepositories)(nil).GetAdminEnforcement), arg0, arg1, arg2, arg3) +} + +// GetArchiveLink mocks base method. +func (m *MockRepositories) GetArchiveLink(arg0 context.Context, arg1, arg2 string, arg3 github.ArchiveFormat, arg4 *github.RepositoryContentGetOptions, arg5 bool) (*url.URL, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetArchiveLink", arg0, arg1, arg2, arg3, arg4, arg5) + ret0, _ := ret[0].(*url.URL) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetArchiveLink indicates an expected call of GetArchiveLink. +func (mr *MockRepositoriesMockRecorder) GetArchiveLink(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetArchiveLink", reflect.TypeOf((*MockRepositories)(nil).GetArchiveLink), arg0, arg1, arg2, arg3, arg4, arg5) +} + +// GetBranch mocks base method. +func (m *MockRepositories) GetBranch(arg0 context.Context, arg1, arg2, arg3 string) (*github.Branch, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBranch", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Branch) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetBranch indicates an expected call of GetBranch. +func (mr *MockRepositoriesMockRecorder) GetBranch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBranch", reflect.TypeOf((*MockRepositories)(nil).GetBranch), arg0, arg1, arg2, arg3) +} + +// GetBranchProtection mocks base method. +func (m *MockRepositories) GetBranchProtection(arg0 context.Context, arg1, arg2, arg3 string) (*github.Protection, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBranchProtection", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Protection) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetBranchProtection indicates an expected call of GetBranchProtection. +func (mr *MockRepositoriesMockRecorder) GetBranchProtection(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBranchProtection", reflect.TypeOf((*MockRepositories)(nil).GetBranchProtection), arg0, arg1, arg2, arg3) +} + +// GetByID mocks base method. +func (m *MockRepositories) GetByID(arg0 context.Context, arg1 int64) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetByID", arg0, arg1) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetByID indicates an expected call of GetByID. +func (mr *MockRepositoriesMockRecorder) GetByID(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockRepositories)(nil).GetByID), arg0, arg1) +} + +// GetCodeOfConduct mocks base method. +func (m *MockRepositories) GetCodeOfConduct(arg0 context.Context, arg1, arg2 string) (*github.CodeOfConduct, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCodeOfConduct", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.CodeOfConduct) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCodeOfConduct indicates an expected call of GetCodeOfConduct. +func (mr *MockRepositoriesMockRecorder) GetCodeOfConduct(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCodeOfConduct", reflect.TypeOf((*MockRepositories)(nil).GetCodeOfConduct), arg0, arg1, arg2) +} + +// GetCombinedStatus mocks base method. +func (m *MockRepositories) GetCombinedStatus(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.ListOptions) (*github.CombinedStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCombinedStatus", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.CombinedStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCombinedStatus indicates an expected call of GetCombinedStatus. +func (mr *MockRepositoriesMockRecorder) GetCombinedStatus(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCombinedStatus", reflect.TypeOf((*MockRepositories)(nil).GetCombinedStatus), arg0, arg1, arg2, arg3, arg4) +} + +// GetComment mocks base method. +func (m *MockRepositories) GetComment(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.RepositoryComment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryComment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetComment indicates an expected call of GetComment. +func (mr *MockRepositoriesMockRecorder) GetComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComment", reflect.TypeOf((*MockRepositories)(nil).GetComment), arg0, arg1, arg2, arg3) +} + +// GetCommit mocks base method. +func (m *MockRepositories) GetCommit(arg0 context.Context, arg1, arg2, arg3 string) (*github.RepositoryCommit, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommit", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryCommit) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCommit indicates an expected call of GetCommit. +func (mr *MockRepositoriesMockRecorder) GetCommit(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommit", reflect.TypeOf((*MockRepositories)(nil).GetCommit), arg0, arg1, arg2, arg3) +} + +// GetCommitRaw mocks base method. +func (m *MockRepositories) GetCommitRaw(arg0 context.Context, arg1, arg2, arg3 string, arg4 github.RawOptions) (string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommitRaw", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCommitRaw indicates an expected call of GetCommitRaw. +func (mr *MockRepositoriesMockRecorder) GetCommitRaw(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommitRaw", reflect.TypeOf((*MockRepositories)(nil).GetCommitRaw), arg0, arg1, arg2, arg3, arg4) +} + +// GetCommitSHA1 mocks base method. +func (m *MockRepositories) GetCommitSHA1(arg0 context.Context, arg1, arg2, arg3, arg4 string) (string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommitSHA1", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCommitSHA1 indicates an expected call of GetCommitSHA1. +func (mr *MockRepositoriesMockRecorder) GetCommitSHA1(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommitSHA1", reflect.TypeOf((*MockRepositories)(nil).GetCommitSHA1), arg0, arg1, arg2, arg3, arg4) +} + +// GetCommunityHealthMetrics mocks base method. +func (m *MockRepositories) GetCommunityHealthMetrics(arg0 context.Context, arg1, arg2 string) (*github.CommunityHealthMetrics, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommunityHealthMetrics", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.CommunityHealthMetrics) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetCommunityHealthMetrics indicates an expected call of GetCommunityHealthMetrics. +func (mr *MockRepositoriesMockRecorder) GetCommunityHealthMetrics(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommunityHealthMetrics", reflect.TypeOf((*MockRepositories)(nil).GetCommunityHealthMetrics), arg0, arg1, arg2) +} + +// GetContents mocks base method. +func (m *MockRepositories) GetContents(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentGetOptions) (*github.RepositoryContent, []*github.RepositoryContent, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetContents", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryContent) + ret1, _ := ret[1].([]*github.RepositoryContent) + ret2, _ := ret[2].(*github.Response) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 +} + +// GetContents indicates an expected call of GetContents. +func (mr *MockRepositoriesMockRecorder) GetContents(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContents", reflect.TypeOf((*MockRepositories)(nil).GetContents), arg0, arg1, arg2, arg3, arg4) +} + +// GetDeployment mocks base method. +func (m *MockRepositories) GetDeployment(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Deployment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDeployment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Deployment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetDeployment indicates an expected call of GetDeployment. +func (mr *MockRepositoriesMockRecorder) GetDeployment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeployment", reflect.TypeOf((*MockRepositories)(nil).GetDeployment), arg0, arg1, arg2, arg3) +} + +// GetDeploymentStatus mocks base method. +func (m *MockRepositories) GetDeploymentStatus(arg0 context.Context, arg1, arg2 string, arg3, arg4 int64) (*github.DeploymentStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDeploymentStatus", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.DeploymentStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetDeploymentStatus indicates an expected call of GetDeploymentStatus. +func (mr *MockRepositoriesMockRecorder) GetDeploymentStatus(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeploymentStatus", reflect.TypeOf((*MockRepositories)(nil).GetDeploymentStatus), arg0, arg1, arg2, arg3, arg4) +} + +// GetEnvironment mocks base method. +func (m *MockRepositories) GetEnvironment(arg0 context.Context, arg1, arg2, arg3 string) (*github.Environment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetEnvironment", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Environment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetEnvironment indicates an expected call of GetEnvironment. +func (mr *MockRepositoriesMockRecorder) GetEnvironment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEnvironment", reflect.TypeOf((*MockRepositories)(nil).GetEnvironment), arg0, arg1, arg2, arg3) +} + +// GetHook mocks base method. +func (m *MockRepositories) GetHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Hook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Hook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetHook indicates an expected call of GetHook. +func (mr *MockRepositoriesMockRecorder) GetHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHook", reflect.TypeOf((*MockRepositories)(nil).GetHook), arg0, arg1, arg2, arg3) +} + +// GetKey mocks base method. +func (m *MockRepositories) GetKey(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetKey", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetKey indicates an expected call of GetKey. +func (mr *MockRepositoriesMockRecorder) GetKey(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetKey", reflect.TypeOf((*MockRepositories)(nil).GetKey), arg0, arg1, arg2, arg3) +} + +// GetLatestPagesBuild mocks base method. +func (m *MockRepositories) GetLatestPagesBuild(arg0 context.Context, arg1, arg2 string) (*github.PagesBuild, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLatestPagesBuild", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.PagesBuild) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetLatestPagesBuild indicates an expected call of GetLatestPagesBuild. +func (mr *MockRepositoriesMockRecorder) GetLatestPagesBuild(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLatestPagesBuild", reflect.TypeOf((*MockRepositories)(nil).GetLatestPagesBuild), arg0, arg1, arg2) +} + +// GetLatestRelease mocks base method. +func (m *MockRepositories) GetLatestRelease(arg0 context.Context, arg1, arg2 string) (*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLatestRelease", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetLatestRelease indicates an expected call of GetLatestRelease. +func (mr *MockRepositoriesMockRecorder) GetLatestRelease(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLatestRelease", reflect.TypeOf((*MockRepositories)(nil).GetLatestRelease), arg0, arg1, arg2) +} + +// GetPageBuild mocks base method. +func (m *MockRepositories) GetPageBuild(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.PagesBuild, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPageBuild", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.PagesBuild) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPageBuild indicates an expected call of GetPageBuild. +func (mr *MockRepositoriesMockRecorder) GetPageBuild(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPageBuild", reflect.TypeOf((*MockRepositories)(nil).GetPageBuild), arg0, arg1, arg2, arg3) +} + +// GetPagesInfo mocks base method. +func (m *MockRepositories) GetPagesInfo(arg0 context.Context, arg1, arg2 string) (*github.Pages, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPagesInfo", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Pages) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPagesInfo indicates an expected call of GetPagesInfo. +func (mr *MockRepositoriesMockRecorder) GetPagesInfo(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPagesInfo", reflect.TypeOf((*MockRepositories)(nil).GetPagesInfo), arg0, arg1, arg2) +} + +// GetPermissionLevel mocks base method. +func (m *MockRepositories) GetPermissionLevel(arg0 context.Context, arg1, arg2, arg3 string) (*github.RepositoryPermissionLevel, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPermissionLevel", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryPermissionLevel) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPermissionLevel indicates an expected call of GetPermissionLevel. +func (mr *MockRepositoriesMockRecorder) GetPermissionLevel(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPermissionLevel", reflect.TypeOf((*MockRepositories)(nil).GetPermissionLevel), arg0, arg1, arg2, arg3) +} + +// GetPreReceiveHook mocks base method. +func (m *MockRepositories) GetPreReceiveHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.PreReceiveHook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPreReceiveHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.PreReceiveHook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPreReceiveHook indicates an expected call of GetPreReceiveHook. +func (mr *MockRepositoriesMockRecorder) GetPreReceiveHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPreReceiveHook", reflect.TypeOf((*MockRepositories)(nil).GetPreReceiveHook), arg0, arg1, arg2, arg3) +} + +// GetPullRequestReviewEnforcement mocks base method. +func (m *MockRepositories) GetPullRequestReviewEnforcement(arg0 context.Context, arg1, arg2, arg3 string) (*github.PullRequestReviewsEnforcement, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPullRequestReviewEnforcement", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.PullRequestReviewsEnforcement) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetPullRequestReviewEnforcement indicates an expected call of GetPullRequestReviewEnforcement. +func (mr *MockRepositoriesMockRecorder) GetPullRequestReviewEnforcement(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPullRequestReviewEnforcement", reflect.TypeOf((*MockRepositories)(nil).GetPullRequestReviewEnforcement), arg0, arg1, arg2, arg3) +} + +// GetReadme mocks base method. +func (m *MockRepositories) GetReadme(arg0 context.Context, arg1, arg2 string, arg3 *github.RepositoryContentGetOptions) (*github.RepositoryContent, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReadme", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryContent) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetReadme indicates an expected call of GetReadme. +func (mr *MockRepositoriesMockRecorder) GetReadme(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReadme", reflect.TypeOf((*MockRepositories)(nil).GetReadme), arg0, arg1, arg2, arg3) +} + +// GetRelease mocks base method. +func (m *MockRepositories) GetRelease(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRelease", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetRelease indicates an expected call of GetRelease. +func (mr *MockRepositoriesMockRecorder) GetRelease(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRelease", reflect.TypeOf((*MockRepositories)(nil).GetRelease), arg0, arg1, arg2, arg3) +} + +// GetReleaseAsset mocks base method. +func (m *MockRepositories) GetReleaseAsset(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.ReleaseAsset, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReleaseAsset", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.ReleaseAsset) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetReleaseAsset indicates an expected call of GetReleaseAsset. +func (mr *MockRepositoriesMockRecorder) GetReleaseAsset(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReleaseAsset", reflect.TypeOf((*MockRepositories)(nil).GetReleaseAsset), arg0, arg1, arg2, arg3) +} + +// GetReleaseByTag mocks base method. +func (m *MockRepositories) GetReleaseByTag(arg0 context.Context, arg1, arg2, arg3 string) (*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReleaseByTag", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetReleaseByTag indicates an expected call of GetReleaseByTag. +func (mr *MockRepositoriesMockRecorder) GetReleaseByTag(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReleaseByTag", reflect.TypeOf((*MockRepositories)(nil).GetReleaseByTag), arg0, arg1, arg2, arg3) +} + +// GetRequiredStatusChecks mocks base method. +func (m *MockRepositories) GetRequiredStatusChecks(arg0 context.Context, arg1, arg2, arg3 string) (*github.RequiredStatusChecks, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRequiredStatusChecks", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RequiredStatusChecks) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetRequiredStatusChecks indicates an expected call of GetRequiredStatusChecks. +func (mr *MockRepositoriesMockRecorder) GetRequiredStatusChecks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequiredStatusChecks", reflect.TypeOf((*MockRepositories)(nil).GetRequiredStatusChecks), arg0, arg1, arg2, arg3) +} + +// GetSignaturesProtectedBranch mocks base method. +func (m *MockRepositories) GetSignaturesProtectedBranch(arg0 context.Context, arg1, arg2, arg3 string) (*github.SignaturesProtectedBranch, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSignaturesProtectedBranch", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.SignaturesProtectedBranch) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSignaturesProtectedBranch indicates an expected call of GetSignaturesProtectedBranch. +func (mr *MockRepositoriesMockRecorder) GetSignaturesProtectedBranch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSignaturesProtectedBranch", reflect.TypeOf((*MockRepositories)(nil).GetSignaturesProtectedBranch), arg0, arg1, arg2, arg3) +} + +// GetVulnerabilityAlerts mocks base method. +func (m *MockRepositories) GetVulnerabilityAlerts(arg0 context.Context, arg1, arg2 string) (bool, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVulnerabilityAlerts", arg0, arg1, arg2) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetVulnerabilityAlerts indicates an expected call of GetVulnerabilityAlerts. +func (mr *MockRepositoriesMockRecorder) GetVulnerabilityAlerts(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVulnerabilityAlerts", reflect.TypeOf((*MockRepositories)(nil).GetVulnerabilityAlerts), arg0, arg1, arg2) +} + +// IsCollaborator mocks base method. +func (m *MockRepositories) IsCollaborator(arg0 context.Context, arg1, arg2, arg3 string) (bool, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsCollaborator", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// IsCollaborator indicates an expected call of IsCollaborator. +func (mr *MockRepositoriesMockRecorder) IsCollaborator(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsCollaborator", reflect.TypeOf((*MockRepositories)(nil).IsCollaborator), arg0, arg1, arg2, arg3) +} + +// License mocks base method. +func (m *MockRepositories) License(arg0 context.Context, arg1, arg2 string) (*github.RepositoryLicense, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "License", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.RepositoryLicense) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// License indicates an expected call of License. +func (mr *MockRepositoriesMockRecorder) License(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "License", reflect.TypeOf((*MockRepositories)(nil).License), arg0, arg1, arg2) +} + +// List mocks base method. +func (m *MockRepositories) List(arg0 context.Context, arg1 string, arg2 *github.RepositoryListOptions) ([]*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// List indicates an expected call of List. +func (mr *MockRepositoriesMockRecorder) List(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRepositories)(nil).List), arg0, arg1, arg2) +} + +// ListAll mocks base method. +func (m *MockRepositories) ListAll(arg0 context.Context, arg1 *github.RepositoryListAllOptions) ([]*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAll", arg0, arg1) + ret0, _ := ret[0].([]*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListAll indicates an expected call of ListAll. +func (mr *MockRepositoriesMockRecorder) ListAll(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAll", reflect.TypeOf((*MockRepositories)(nil).ListAll), arg0, arg1) +} + +// ListAllTopics mocks base method. +func (m *MockRepositories) ListAllTopics(arg0 context.Context, arg1, arg2 string) ([]string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAllTopics", arg0, arg1, arg2) + ret0, _ := ret[0].([]string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListAllTopics indicates an expected call of ListAllTopics. +func (mr *MockRepositoriesMockRecorder) ListAllTopics(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAllTopics", reflect.TypeOf((*MockRepositories)(nil).ListAllTopics), arg0, arg1, arg2) +} + +// ListApps mocks base method. +func (m *MockRepositories) ListApps(arg0 context.Context, arg1, arg2, arg3 string) ([]*github.App, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListApps", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.App) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListApps indicates an expected call of ListApps. +func (mr *MockRepositoriesMockRecorder) ListApps(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListApps", reflect.TypeOf((*MockRepositories)(nil).ListApps), arg0, arg1, arg2, arg3) +} + +// ListBranches mocks base method. +func (m *MockRepositories) ListBranches(arg0 context.Context, arg1, arg2 string, arg3 *github.BranchListOptions) ([]*github.Branch, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListBranches", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Branch) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListBranches indicates an expected call of ListBranches. +func (mr *MockRepositoriesMockRecorder) ListBranches(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBranches", reflect.TypeOf((*MockRepositories)(nil).ListBranches), arg0, arg1, arg2, arg3) +} + +// ListBranchesHeadCommit mocks base method. +func (m *MockRepositories) ListBranchesHeadCommit(arg0 context.Context, arg1, arg2, arg3 string) ([]*github.BranchCommit, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListBranchesHeadCommit", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.BranchCommit) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListBranchesHeadCommit indicates an expected call of ListBranchesHeadCommit. +func (mr *MockRepositoriesMockRecorder) ListBranchesHeadCommit(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBranchesHeadCommit", reflect.TypeOf((*MockRepositories)(nil).ListBranchesHeadCommit), arg0, arg1, arg2, arg3) +} + +// ListByOrg mocks base method. +func (m *MockRepositories) ListByOrg(arg0 context.Context, arg1 string, arg2 *github.RepositoryListByOrgOptions) ([]*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListByOrg", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListByOrg indicates an expected call of ListByOrg. +func (mr *MockRepositoriesMockRecorder) ListByOrg(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByOrg", reflect.TypeOf((*MockRepositories)(nil).ListByOrg), arg0, arg1, arg2) +} + +// ListCodeFrequency mocks base method. +func (m *MockRepositories) ListCodeFrequency(arg0 context.Context, arg1, arg2 string) ([]*github.WeeklyStats, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListCodeFrequency", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.WeeklyStats) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListCodeFrequency indicates an expected call of ListCodeFrequency. +func (mr *MockRepositoriesMockRecorder) ListCodeFrequency(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCodeFrequency", reflect.TypeOf((*MockRepositories)(nil).ListCodeFrequency), arg0, arg1, arg2) +} + +// ListCollaborators mocks base method. +func (m *MockRepositories) ListCollaborators(arg0 context.Context, arg1, arg2 string, arg3 *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListCollaborators", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListCollaborators indicates an expected call of ListCollaborators. +func (mr *MockRepositoriesMockRecorder) ListCollaborators(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCollaborators", reflect.TypeOf((*MockRepositories)(nil).ListCollaborators), arg0, arg1, arg2, arg3) +} + +// ListComments mocks base method. +func (m *MockRepositories) ListComments(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.RepositoryComment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListComments", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.RepositoryComment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListComments indicates an expected call of ListComments. +func (mr *MockRepositoriesMockRecorder) ListComments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListComments", reflect.TypeOf((*MockRepositories)(nil).ListComments), arg0, arg1, arg2, arg3) +} + +// ListCommitActivity mocks base method. +func (m *MockRepositories) ListCommitActivity(arg0 context.Context, arg1, arg2 string) ([]*github.WeeklyCommitActivity, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListCommitActivity", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.WeeklyCommitActivity) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListCommitActivity indicates an expected call of ListCommitActivity. +func (mr *MockRepositoriesMockRecorder) ListCommitActivity(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCommitActivity", reflect.TypeOf((*MockRepositories)(nil).ListCommitActivity), arg0, arg1, arg2) +} + +// ListCommitComments mocks base method. +func (m *MockRepositories) ListCommitComments(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.ListOptions) ([]*github.RepositoryComment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListCommitComments", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.RepositoryComment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListCommitComments indicates an expected call of ListCommitComments. +func (mr *MockRepositoriesMockRecorder) ListCommitComments(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCommitComments", reflect.TypeOf((*MockRepositories)(nil).ListCommitComments), arg0, arg1, arg2, arg3, arg4) +} + +// ListCommits mocks base method. +func (m *MockRepositories) ListCommits(arg0 context.Context, arg1, arg2 string, arg3 *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListCommits", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.RepositoryCommit) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListCommits indicates an expected call of ListCommits. +func (mr *MockRepositoriesMockRecorder) ListCommits(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCommits", reflect.TypeOf((*MockRepositories)(nil).ListCommits), arg0, arg1, arg2, arg3) +} + +// ListContributors mocks base method. +func (m *MockRepositories) ListContributors(arg0 context.Context, arg1, arg2 string, arg3 *github.ListContributorsOptions) ([]*github.Contributor, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListContributors", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Contributor) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListContributors indicates an expected call of ListContributors. +func (mr *MockRepositoriesMockRecorder) ListContributors(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListContributors", reflect.TypeOf((*MockRepositories)(nil).ListContributors), arg0, arg1, arg2, arg3) +} + +// ListContributorsStats mocks base method. +func (m *MockRepositories) ListContributorsStats(arg0 context.Context, arg1, arg2 string) ([]*github.ContributorStats, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListContributorsStats", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.ContributorStats) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListContributorsStats indicates an expected call of ListContributorsStats. +func (mr *MockRepositoriesMockRecorder) ListContributorsStats(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListContributorsStats", reflect.TypeOf((*MockRepositories)(nil).ListContributorsStats), arg0, arg1, arg2) +} + +// ListDeploymentStatuses mocks base method. +func (m *MockRepositories) ListDeploymentStatuses(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.ListOptions) ([]*github.DeploymentStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListDeploymentStatuses", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.DeploymentStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListDeploymentStatuses indicates an expected call of ListDeploymentStatuses. +func (mr *MockRepositoriesMockRecorder) ListDeploymentStatuses(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDeploymentStatuses", reflect.TypeOf((*MockRepositories)(nil).ListDeploymentStatuses), arg0, arg1, arg2, arg3, arg4) +} + +// ListDeployments mocks base method. +func (m *MockRepositories) ListDeployments(arg0 context.Context, arg1, arg2 string, arg3 *github.DeploymentsListOptions) ([]*github.Deployment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListDeployments", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Deployment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListDeployments indicates an expected call of ListDeployments. +func (mr *MockRepositoriesMockRecorder) ListDeployments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDeployments", reflect.TypeOf((*MockRepositories)(nil).ListDeployments), arg0, arg1, arg2, arg3) +} + +// ListEnvironments mocks base method. +func (m *MockRepositories) ListEnvironments(arg0 context.Context, arg1, arg2 string) (*github.EnvResponse, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListEnvironments", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.EnvResponse) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListEnvironments indicates an expected call of ListEnvironments. +func (mr *MockRepositoriesMockRecorder) ListEnvironments(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEnvironments", reflect.TypeOf((*MockRepositories)(nil).ListEnvironments), arg0, arg1, arg2) +} + +// ListForks mocks base method. +func (m *MockRepositories) ListForks(arg0 context.Context, arg1, arg2 string, arg3 *github.RepositoryListForksOptions) ([]*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListForks", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListForks indicates an expected call of ListForks. +func (mr *MockRepositoriesMockRecorder) ListForks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListForks", reflect.TypeOf((*MockRepositories)(nil).ListForks), arg0, arg1, arg2, arg3) +} + +// ListHooks mocks base method. +func (m *MockRepositories) ListHooks(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.Hook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListHooks", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Hook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListHooks indicates an expected call of ListHooks. +func (mr *MockRepositoriesMockRecorder) ListHooks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListHooks", reflect.TypeOf((*MockRepositories)(nil).ListHooks), arg0, arg1, arg2, arg3) +} + +// ListInvitations mocks base method. +func (m *MockRepositories) ListInvitations(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.RepositoryInvitation, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInvitations", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.RepositoryInvitation) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListInvitations indicates an expected call of ListInvitations. +func (mr *MockRepositoriesMockRecorder) ListInvitations(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInvitations", reflect.TypeOf((*MockRepositories)(nil).ListInvitations), arg0, arg1, arg2, arg3) +} + +// ListKeys mocks base method. +func (m *MockRepositories) ListKeys(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListKeys", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListKeys indicates an expected call of ListKeys. +func (mr *MockRepositoriesMockRecorder) ListKeys(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListKeys", reflect.TypeOf((*MockRepositories)(nil).ListKeys), arg0, arg1, arg2, arg3) +} + +// ListLanguages mocks base method. +func (m *MockRepositories) ListLanguages(arg0 context.Context, arg1, arg2 string) (map[string]int, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListLanguages", arg0, arg1, arg2) + ret0, _ := ret[0].(map[string]int) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListLanguages indicates an expected call of ListLanguages. +func (mr *MockRepositoriesMockRecorder) ListLanguages(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLanguages", reflect.TypeOf((*MockRepositories)(nil).ListLanguages), arg0, arg1, arg2) +} + +// ListPagesBuilds mocks base method. +func (m *MockRepositories) ListPagesBuilds(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.PagesBuild, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPagesBuilds", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.PagesBuild) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListPagesBuilds indicates an expected call of ListPagesBuilds. +func (mr *MockRepositoriesMockRecorder) ListPagesBuilds(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPagesBuilds", reflect.TypeOf((*MockRepositories)(nil).ListPagesBuilds), arg0, arg1, arg2, arg3) +} + +// ListParticipation mocks base method. +func (m *MockRepositories) ListParticipation(arg0 context.Context, arg1, arg2 string) (*github.RepositoryParticipation, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListParticipation", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.RepositoryParticipation) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListParticipation indicates an expected call of ListParticipation. +func (mr *MockRepositoriesMockRecorder) ListParticipation(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListParticipation", reflect.TypeOf((*MockRepositories)(nil).ListParticipation), arg0, arg1, arg2) +} + +// ListPreReceiveHooks mocks base method. +func (m *MockRepositories) ListPreReceiveHooks(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.PreReceiveHook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPreReceiveHooks", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.PreReceiveHook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListPreReceiveHooks indicates an expected call of ListPreReceiveHooks. +func (mr *MockRepositoriesMockRecorder) ListPreReceiveHooks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPreReceiveHooks", reflect.TypeOf((*MockRepositories)(nil).ListPreReceiveHooks), arg0, arg1, arg2, arg3) +} + +// ListProjects mocks base method. +func (m *MockRepositories) ListProjects(arg0 context.Context, arg1, arg2 string, arg3 *github.ProjectListOptions) ([]*github.Project, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListProjects", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Project) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListProjects indicates an expected call of ListProjects. +func (mr *MockRepositoriesMockRecorder) ListProjects(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListProjects", reflect.TypeOf((*MockRepositories)(nil).ListProjects), arg0, arg1, arg2, arg3) +} + +// ListPunchCard mocks base method. +func (m *MockRepositories) ListPunchCard(arg0 context.Context, arg1, arg2 string) ([]*github.PunchCard, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPunchCard", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.PunchCard) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListPunchCard indicates an expected call of ListPunchCard. +func (mr *MockRepositoriesMockRecorder) ListPunchCard(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPunchCard", reflect.TypeOf((*MockRepositories)(nil).ListPunchCard), arg0, arg1, arg2) +} + +// ListReleaseAssets mocks base method. +func (m *MockRepositories) ListReleaseAssets(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListReleaseAssets", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.ReleaseAsset) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListReleaseAssets indicates an expected call of ListReleaseAssets. +func (mr *MockRepositoriesMockRecorder) ListReleaseAssets(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListReleaseAssets", reflect.TypeOf((*MockRepositories)(nil).ListReleaseAssets), arg0, arg1, arg2, arg3, arg4) +} + +// ListReleases mocks base method. +func (m *MockRepositories) ListReleases(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListReleases", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.RepositoryRelease) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListReleases indicates an expected call of ListReleases. +func (mr *MockRepositoriesMockRecorder) ListReleases(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListReleases", reflect.TypeOf((*MockRepositories)(nil).ListReleases), arg0, arg1, arg2, arg3) +} + +// ListRequiredStatusChecksContexts mocks base method. +func (m *MockRepositories) ListRequiredStatusChecksContexts(arg0 context.Context, arg1, arg2, arg3 string) ([]string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRequiredStatusChecksContexts", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListRequiredStatusChecksContexts indicates an expected call of ListRequiredStatusChecksContexts. +func (mr *MockRepositoriesMockRecorder) ListRequiredStatusChecksContexts(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRequiredStatusChecksContexts", reflect.TypeOf((*MockRepositories)(nil).ListRequiredStatusChecksContexts), arg0, arg1, arg2, arg3) +} + +// ListStatuses mocks base method. +func (m *MockRepositories) ListStatuses(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.ListOptions) ([]*github.RepoStatus, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStatuses", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.RepoStatus) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListStatuses indicates an expected call of ListStatuses. +func (mr *MockRepositoriesMockRecorder) ListStatuses(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStatuses", reflect.TypeOf((*MockRepositories)(nil).ListStatuses), arg0, arg1, arg2, arg3, arg4) +} + +// ListTags mocks base method. +func (m *MockRepositories) ListTags(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTags", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.RepositoryTag) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTags indicates an expected call of ListTags. +func (mr *MockRepositoriesMockRecorder) ListTags(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTags", reflect.TypeOf((*MockRepositories)(nil).ListTags), arg0, arg1, arg2, arg3) +} + +// ListTeams mocks base method. +func (m *MockRepositories) ListTeams(arg0 context.Context, arg1, arg2 string, arg3 *github.ListOptions) ([]*github.Team, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTeams", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]*github.Team) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTeams indicates an expected call of ListTeams. +func (mr *MockRepositoriesMockRecorder) ListTeams(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTeams", reflect.TypeOf((*MockRepositories)(nil).ListTeams), arg0, arg1, arg2, arg3) +} + +// ListTrafficClones mocks base method. +func (m *MockRepositories) ListTrafficClones(arg0 context.Context, arg1, arg2 string, arg3 *github.TrafficBreakdownOptions) (*github.TrafficClones, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTrafficClones", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.TrafficClones) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTrafficClones indicates an expected call of ListTrafficClones. +func (mr *MockRepositoriesMockRecorder) ListTrafficClones(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrafficClones", reflect.TypeOf((*MockRepositories)(nil).ListTrafficClones), arg0, arg1, arg2, arg3) +} + +// ListTrafficPaths mocks base method. +func (m *MockRepositories) ListTrafficPaths(arg0 context.Context, arg1, arg2 string) ([]*github.TrafficPath, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTrafficPaths", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.TrafficPath) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTrafficPaths indicates an expected call of ListTrafficPaths. +func (mr *MockRepositoriesMockRecorder) ListTrafficPaths(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrafficPaths", reflect.TypeOf((*MockRepositories)(nil).ListTrafficPaths), arg0, arg1, arg2) +} + +// ListTrafficReferrers mocks base method. +func (m *MockRepositories) ListTrafficReferrers(arg0 context.Context, arg1, arg2 string) ([]*github.TrafficReferrer, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTrafficReferrers", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.TrafficReferrer) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTrafficReferrers indicates an expected call of ListTrafficReferrers. +func (mr *MockRepositoriesMockRecorder) ListTrafficReferrers(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrafficReferrers", reflect.TypeOf((*MockRepositories)(nil).ListTrafficReferrers), arg0, arg1, arg2) +} + +// ListTrafficViews mocks base method. +func (m *MockRepositories) ListTrafficViews(arg0 context.Context, arg1, arg2 string, arg3 *github.TrafficBreakdownOptions) (*github.TrafficViews, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTrafficViews", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.TrafficViews) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListTrafficViews indicates an expected call of ListTrafficViews. +func (mr *MockRepositoriesMockRecorder) ListTrafficViews(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrafficViews", reflect.TypeOf((*MockRepositories)(nil).ListTrafficViews), arg0, arg1, arg2, arg3) +} + +// Merge mocks base method. +func (m *MockRepositories) Merge(arg0 context.Context, arg1, arg2 string, arg3 *github.RepositoryMergeRequest) (*github.RepositoryCommit, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Merge", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.RepositoryCommit) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Merge indicates an expected call of Merge. +func (mr *MockRepositoriesMockRecorder) Merge(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Merge", reflect.TypeOf((*MockRepositories)(nil).Merge), arg0, arg1, arg2, arg3) +} + +// OptionalSignaturesOnProtectedBranch mocks base method. +func (m *MockRepositories) OptionalSignaturesOnProtectedBranch(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "OptionalSignaturesOnProtectedBranch", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// OptionalSignaturesOnProtectedBranch indicates an expected call of OptionalSignaturesOnProtectedBranch. +func (mr *MockRepositoriesMockRecorder) OptionalSignaturesOnProtectedBranch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OptionalSignaturesOnProtectedBranch", reflect.TypeOf((*MockRepositories)(nil).OptionalSignaturesOnProtectedBranch), arg0, arg1, arg2, arg3) +} + +// PingHook mocks base method. +func (m *MockRepositories) PingHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PingHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PingHook indicates an expected call of PingHook. +func (mr *MockRepositoriesMockRecorder) PingHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PingHook", reflect.TypeOf((*MockRepositories)(nil).PingHook), arg0, arg1, arg2, arg3) +} + +// RemoveAdminEnforcement mocks base method. +func (m *MockRepositories) RemoveAdminEnforcement(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveAdminEnforcement", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveAdminEnforcement indicates an expected call of RemoveAdminEnforcement. +func (mr *MockRepositoriesMockRecorder) RemoveAdminEnforcement(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAdminEnforcement", reflect.TypeOf((*MockRepositories)(nil).RemoveAdminEnforcement), arg0, arg1, arg2, arg3) +} + +// RemoveAppRestrictions mocks base method. +func (m *MockRepositories) RemoveAppRestrictions(arg0 context.Context, arg1, arg2, arg3 string, arg4 []string) ([]*github.App, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveAppRestrictions", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.App) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RemoveAppRestrictions indicates an expected call of RemoveAppRestrictions. +func (mr *MockRepositoriesMockRecorder) RemoveAppRestrictions(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAppRestrictions", reflect.TypeOf((*MockRepositories)(nil).RemoveAppRestrictions), arg0, arg1, arg2, arg3, arg4) +} + +// RemoveBranchProtection mocks base method. +func (m *MockRepositories) RemoveBranchProtection(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveBranchProtection", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveBranchProtection indicates an expected call of RemoveBranchProtection. +func (mr *MockRepositoriesMockRecorder) RemoveBranchProtection(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveBranchProtection", reflect.TypeOf((*MockRepositories)(nil).RemoveBranchProtection), arg0, arg1, arg2, arg3) +} + +// RemoveCollaborator mocks base method. +func (m *MockRepositories) RemoveCollaborator(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveCollaborator", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveCollaborator indicates an expected call of RemoveCollaborator. +func (mr *MockRepositoriesMockRecorder) RemoveCollaborator(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveCollaborator", reflect.TypeOf((*MockRepositories)(nil).RemoveCollaborator), arg0, arg1, arg2, arg3) +} + +// RemovePullRequestReviewEnforcement mocks base method. +func (m *MockRepositories) RemovePullRequestReviewEnforcement(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemovePullRequestReviewEnforcement", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemovePullRequestReviewEnforcement indicates an expected call of RemovePullRequestReviewEnforcement. +func (mr *MockRepositoriesMockRecorder) RemovePullRequestReviewEnforcement(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePullRequestReviewEnforcement", reflect.TypeOf((*MockRepositories)(nil).RemovePullRequestReviewEnforcement), arg0, arg1, arg2, arg3) +} + +// RemoveRequiredStatusChecks mocks base method. +func (m *MockRepositories) RemoveRequiredStatusChecks(arg0 context.Context, arg1, arg2, arg3 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveRequiredStatusChecks", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveRequiredStatusChecks indicates an expected call of RemoveRequiredStatusChecks. +func (mr *MockRepositoriesMockRecorder) RemoveRequiredStatusChecks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRequiredStatusChecks", reflect.TypeOf((*MockRepositories)(nil).RemoveRequiredStatusChecks), arg0, arg1, arg2, arg3) +} + +// ReplaceAllTopics mocks base method. +func (m *MockRepositories) ReplaceAllTopics(arg0 context.Context, arg1, arg2 string, arg3 []string) ([]string, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReplaceAllTopics", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([]string) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ReplaceAllTopics indicates an expected call of ReplaceAllTopics. +func (mr *MockRepositoriesMockRecorder) ReplaceAllTopics(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplaceAllTopics", reflect.TypeOf((*MockRepositories)(nil).ReplaceAllTopics), arg0, arg1, arg2, arg3) +} + +// ReplaceAppRestrictions mocks base method. +func (m *MockRepositories) ReplaceAppRestrictions(arg0 context.Context, arg1, arg2, arg3 string, arg4 []string) ([]*github.App, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReplaceAppRestrictions", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].([]*github.App) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ReplaceAppRestrictions indicates an expected call of ReplaceAppRestrictions. +func (mr *MockRepositoriesMockRecorder) ReplaceAppRestrictions(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplaceAppRestrictions", reflect.TypeOf((*MockRepositories)(nil).ReplaceAppRestrictions), arg0, arg1, arg2, arg3, arg4) +} + +// RequestPageBuild mocks base method. +func (m *MockRepositories) RequestPageBuild(arg0 context.Context, arg1, arg2 string) (*github.PagesBuild, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RequestPageBuild", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.PagesBuild) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RequestPageBuild indicates an expected call of RequestPageBuild. +func (mr *MockRepositoriesMockRecorder) RequestPageBuild(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequestPageBuild", reflect.TypeOf((*MockRepositories)(nil).RequestPageBuild), arg0, arg1, arg2) +} + +// RequireSignaturesOnProtectedBranch mocks base method. +func (m *MockRepositories) RequireSignaturesOnProtectedBranch(arg0 context.Context, arg1, arg2, arg3 string) (*github.SignaturesProtectedBranch, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RequireSignaturesOnProtectedBranch", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.SignaturesProtectedBranch) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// RequireSignaturesOnProtectedBranch indicates an expected call of RequireSignaturesOnProtectedBranch. +func (mr *MockRepositoriesMockRecorder) RequireSignaturesOnProtectedBranch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequireSignaturesOnProtectedBranch", reflect.TypeOf((*MockRepositories)(nil).RequireSignaturesOnProtectedBranch), arg0, arg1, arg2, arg3) +} + +// TestHook mocks base method. +func (m *MockRepositories) TestHook(arg0 context.Context, arg1, arg2 string, arg3 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TestHook", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TestHook indicates an expected call of TestHook. +func (mr *MockRepositoriesMockRecorder) TestHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TestHook", reflect.TypeOf((*MockRepositories)(nil).TestHook), arg0, arg1, arg2, arg3) +} + +// Transfer mocks base method. +func (m *MockRepositories) Transfer(arg0 context.Context, arg1, arg2 string, arg3 github.TransferRequest) (*github.Repository, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Transfer", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Repository) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Transfer indicates an expected call of Transfer. +func (mr *MockRepositoriesMockRecorder) Transfer(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Transfer", reflect.TypeOf((*MockRepositories)(nil).Transfer), arg0, arg1, arg2, arg3) +} + +// UpdateBranchProtection mocks base method. +func (m *MockRepositories) UpdateBranchProtection(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.ProtectionRequest) (*github.Protection, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateBranchProtection", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.Protection) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateBranchProtection indicates an expected call of UpdateBranchProtection. +func (mr *MockRepositoriesMockRecorder) UpdateBranchProtection(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateBranchProtection", reflect.TypeOf((*MockRepositories)(nil).UpdateBranchProtection), arg0, arg1, arg2, arg3, arg4) +} + +// UpdateComment mocks base method. +func (m *MockRepositories) UpdateComment(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateComment", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryComment) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateComment indicates an expected call of UpdateComment. +func (mr *MockRepositoriesMockRecorder) UpdateComment(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateComment", reflect.TypeOf((*MockRepositories)(nil).UpdateComment), arg0, arg1, arg2, arg3, arg4) +} + +// UpdateFile mocks base method. +func (m *MockRepositories) UpdateFile(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateFile", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryContentResponse) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateFile indicates an expected call of UpdateFile. +func (mr *MockRepositoriesMockRecorder) UpdateFile(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateFile", reflect.TypeOf((*MockRepositories)(nil).UpdateFile), arg0, arg1, arg2, arg3, arg4) +} + +// UpdateInvitation mocks base method. +func (m *MockRepositories) UpdateInvitation(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 string) (*github.RepositoryInvitation, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateInvitation", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RepositoryInvitation) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateInvitation indicates an expected call of UpdateInvitation. +func (mr *MockRepositoriesMockRecorder) UpdateInvitation(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateInvitation", reflect.TypeOf((*MockRepositories)(nil).UpdateInvitation), arg0, arg1, arg2, arg3, arg4) +} + +// UpdatePages mocks base method. +func (m *MockRepositories) UpdatePages(arg0 context.Context, arg1, arg2 string, arg3 *github.PagesUpdate) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePages", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdatePages indicates an expected call of UpdatePages. +func (mr *MockRepositoriesMockRecorder) UpdatePages(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePages", reflect.TypeOf((*MockRepositories)(nil).UpdatePages), arg0, arg1, arg2, arg3) +} + +// UpdatePreReceiveHook mocks base method. +func (m *MockRepositories) UpdatePreReceiveHook(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.PreReceiveHook) (*github.PreReceiveHook, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePreReceiveHook", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.PreReceiveHook) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdatePreReceiveHook indicates an expected call of UpdatePreReceiveHook. +func (mr *MockRepositoriesMockRecorder) UpdatePreReceiveHook(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePreReceiveHook", reflect.TypeOf((*MockRepositories)(nil).UpdatePreReceiveHook), arg0, arg1, arg2, arg3, arg4) +} + +// UpdatePullRequestReviewEnforcement mocks base method. +func (m *MockRepositories) UpdatePullRequestReviewEnforcement(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.PullRequestReviewsEnforcementUpdate) (*github.PullRequestReviewsEnforcement, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePullRequestReviewEnforcement", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.PullRequestReviewsEnforcement) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdatePullRequestReviewEnforcement indicates an expected call of UpdatePullRequestReviewEnforcement. +func (mr *MockRepositoriesMockRecorder) UpdatePullRequestReviewEnforcement(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePullRequestReviewEnforcement", reflect.TypeOf((*MockRepositories)(nil).UpdatePullRequestReviewEnforcement), arg0, arg1, arg2, arg3, arg4) +} + +// UpdateRequiredStatusChecks mocks base method. +func (m *MockRepositories) UpdateRequiredStatusChecks(arg0 context.Context, arg1, arg2, arg3 string, arg4 *github.RequiredStatusChecksRequest) (*github.RequiredStatusChecks, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRequiredStatusChecks", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*github.RequiredStatusChecks) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateRequiredStatusChecks indicates an expected call of UpdateRequiredStatusChecks. +func (mr *MockRepositoriesMockRecorder) UpdateRequiredStatusChecks(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRequiredStatusChecks", reflect.TypeOf((*MockRepositories)(nil).UpdateRequiredStatusChecks), arg0, arg1, arg2, arg3, arg4) +} + +// UploadReleaseAsset mocks base method. +func (m *MockRepositories) UploadReleaseAsset(arg0 context.Context, arg1, arg2 string, arg3 int64, arg4 *github.UploadOptions, arg5 *os.File) (*github.ReleaseAsset, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadReleaseAsset", arg0, arg1, arg2, arg3, arg4, arg5) + ret0, _ := ret[0].(*github.ReleaseAsset) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UploadReleaseAsset indicates an expected call of UploadReleaseAsset. +func (mr *MockRepositoriesMockRecorder) UploadReleaseAsset(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadReleaseAsset", reflect.TypeOf((*MockRepositories)(nil).UploadReleaseAsset), arg0, arg1, arg2, arg3, arg4, arg5) +} diff --git a/pkg/git/github/mocks/repositories.go b/pkg/git/github/mocks/repositories.go deleted file mode 100644 index 83d269f8..00000000 --- a/pkg/git/github/mocks/repositories.go +++ /dev/null @@ -1,4326 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import ( - context "context" - - github "github.com/google/go-github/v35/github" - - http "net/http" - - io "io" - - mock "github.com/stretchr/testify/mock" - - os "os" - - url "net/url" -) - -// Repositories is an autogenerated mock type for the Repositories type -type Repositories struct { - mock.Mock -} - -// AddAdminEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) AddAdminEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.AdminEnforcement, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.AdminEnforcement - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.AdminEnforcement); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.AdminEnforcement) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// AddAppRestrictions provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) AddAppRestrictions(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 []string) ([]*github.App, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.App - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []string) []*github.App); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.App) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, []string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, []string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// AddCollaborator provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) AddCollaborator(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryAddCollaboratorOptions) (*github.CollaboratorInvitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.CollaboratorInvitation - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryAddCollaboratorOptions) *github.CollaboratorInvitation); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.CollaboratorInvitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryAddCollaboratorOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryAddCollaboratorOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CompareCommits provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CompareCommits(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 string) (*github.CommitsComparison, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.CommitsComparison - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) *github.CommitsComparison); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.CommitsComparison) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CompareCommitsRaw provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 -func (_m *Repositories) CompareCommitsRaw(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 string, _a5 github.RawOptions) (string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) - - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, github.RawOptions) string); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - r0 = ret.Get(0).(string) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, github.RawOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, string, github.RawOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Create provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) Create(_a0 context.Context, _a1 string, _a2 *github.Repository) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, *github.Repository) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.Repository) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.Repository) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateComment provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CreateComment(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryComment - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryComment) *github.RepositoryComment); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryComment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryComment) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryComment) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateDeployment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateDeployment(_a0 context.Context, _a1 string, _a2 string, _a3 *github.DeploymentRequest) (*github.Deployment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Deployment - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.DeploymentRequest) *github.Deployment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Deployment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.DeploymentRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.DeploymentRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateDeploymentStatus provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CreateDeploymentStatus(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.DeploymentStatusRequest) (*github.DeploymentStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.DeploymentStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.DeploymentStatusRequest) *github.DeploymentStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.DeploymentStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.DeploymentStatusRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.DeploymentStatusRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateFile provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CreateFile(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryContentResponse - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.RepositoryContentResponse); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryContentResponse) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateFork provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateFork(_a0 context.Context, _a1 string, _a2 string, _a3 *github.RepositoryCreateForkOptions) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.RepositoryCreateForkOptions) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.RepositoryCreateForkOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.RepositoryCreateForkOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateFromTemplate provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateFromTemplate(_a0 context.Context, _a1 string, _a2 string, _a3 *github.TemplateRepoRequest) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.TemplateRepoRequest) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.TemplateRepoRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.TemplateRepoRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateHook(_a0 context.Context, _a1 string, _a2 string, _a3 *github.Hook) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.Hook) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.Hook) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.Hook) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateKey provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateKey(_a0 context.Context, _a1 string, _a2 string, _a3 *github.Key) (*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Key - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.Key) *github.Key); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.Key) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.Key) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateProject provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateProject(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ProjectOptions) (*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Project - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ProjectOptions) *github.Project); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ProjectOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ProjectOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateRelease provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) CreateRelease(_a0 context.Context, _a1 string, _a2 string, _a3 *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.RepositoryRelease) *github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.RepositoryRelease) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.RepositoryRelease) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateStatus provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CreateStatus(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepoStatus) (*github.RepoStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepoStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepoStatus) *github.RepoStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepoStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepoStatus) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepoStatus) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateUpdateEnvironment provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) CreateUpdateEnvironment(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.CreateUpdateEnvironment) (*github.Environment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.Environment - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.CreateUpdateEnvironment) *github.Environment); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Environment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.CreateUpdateEnvironment) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.CreateUpdateEnvironment) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Delete provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) Delete(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteComment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteComment(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteDeployment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteDeployment(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteEnvironment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteEnvironment(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteFile provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) DeleteFile(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryContentResponse - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.RepositoryContentResponse); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryContentResponse) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DeleteHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteInvitation provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteInvitation(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteKey provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteKey(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeletePreReceiveHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeletePreReceiveHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteRelease provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteRelease(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteReleaseAsset provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DeleteReleaseAsset(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableAutomatedSecurityFixes provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) DisableAutomatedSecurityFixes(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableDismissalRestrictions provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) DisableDismissalRestrictions(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.PullRequestReviewsEnforcement, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.PullRequestReviewsEnforcement - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.PullRequestReviewsEnforcement); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PullRequestReviewsEnforcement) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DisablePages provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) DisablePages(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DisableVulnerabilityAlerts provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) DisableVulnerabilityAlerts(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Dispatch provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) Dispatch(_a0 context.Context, _a1 string, _a2 string, _a3 github.DispatchRequestOptions) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, github.DispatchRequestOptions) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, github.DispatchRequestOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, github.DispatchRequestOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DownloadContents provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) DownloadContents(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentGetOptions) (io.ReadCloser, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 io.ReadCloser - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) io.ReadCloser); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(io.ReadCloser) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DownloadContentsWithMeta provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) DownloadContentsWithMeta(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentGetOptions) (io.ReadCloser, *github.RepositoryContent, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 io.ReadCloser - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) io.ReadCloser); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(io.ReadCloser) - } - } - - var r1 *github.RepositoryContent - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) *github.RepositoryContent); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.RepositoryContent) - } - } - - var r2 *github.Response - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) *github.Response); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(2) != nil { - r2 = ret.Get(2).(*github.Response) - } - } - - var r3 error - if rf, ok := ret.Get(3).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) error); ok { - r3 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r3 = ret.Error(3) - } - - return r0, r1, r2, r3 -} - -// DownloadReleaseAsset provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) DownloadReleaseAsset(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *http.Client) (io.ReadCloser, string, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 io.ReadCloser - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *http.Client) io.ReadCloser); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(io.ReadCloser) - } - } - - var r1 string - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *http.Client) string); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r1 = ret.Get(1).(string) - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *http.Client) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Edit provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) Edit(_a0 context.Context, _a1 string, _a2 string, _a3 *github.Repository) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.Repository) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.Repository) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.Repository) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditHook provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) EditHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.Hook) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.Hook) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.Hook) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.Hook) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditRelease provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) EditRelease(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.RepositoryRelease) (*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.RepositoryRelease) *github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.RepositoryRelease) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.RepositoryRelease) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EditReleaseAsset provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) EditReleaseAsset(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.ReleaseAsset) (*github.ReleaseAsset, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.ReleaseAsset - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.ReleaseAsset) *github.ReleaseAsset); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ReleaseAsset) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.ReleaseAsset) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.ReleaseAsset) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EnableAutomatedSecurityFixes provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) EnableAutomatedSecurityFixes(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// EnablePages provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) EnablePages(_a0 context.Context, _a1 string, _a2 string, _a3 *github.Pages) (*github.Pages, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Pages - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.Pages) *github.Pages); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Pages) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.Pages) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.Pages) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// EnableVulnerabilityAlerts provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) EnableVulnerabilityAlerts(_a0 context.Context, _a1 string, _a2 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Get provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) Get(_a0 context.Context, _a1 string, _a2 string) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetAdminEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetAdminEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.AdminEnforcement, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.AdminEnforcement - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.AdminEnforcement); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.AdminEnforcement) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetArchiveLink provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 -func (_m *Repositories) GetArchiveLink(_a0 context.Context, _a1 string, _a2 string, _a3 github.ArchiveFormat, _a4 *github.RepositoryContentGetOptions, _a5 bool) (*url.URL, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) - - var r0 *url.URL - if rf, ok := ret.Get(0).(func(context.Context, string, string, github.ArchiveFormat, *github.RepositoryContentGetOptions, bool) *url.URL); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*url.URL) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, github.ArchiveFormat, *github.RepositoryContentGetOptions, bool) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, github.ArchiveFormat, *github.RepositoryContentGetOptions, bool) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetBranch provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetBranch(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Branch, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Branch - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Branch); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Branch) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetBranchProtection provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetBranchProtection(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Protection, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Protection - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Protection); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Protection) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetByID provides a mock function with given fields: _a0, _a1 -func (_m *Repositories) GetByID(_a0 context.Context, _a1 int64) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Repository); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, int64) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, int64) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCodeOfConduct provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetCodeOfConduct(_a0 context.Context, _a1 string, _a2 string) (*github.CodeOfConduct, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.CodeOfConduct - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.CodeOfConduct); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.CodeOfConduct) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCombinedStatus provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) GetCombinedStatus(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.ListOptions) (*github.CombinedStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.CombinedStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.ListOptions) *github.CombinedStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.CombinedStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetComment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetComment(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.RepositoryComment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryComment - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.RepositoryComment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryComment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCommit provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetCommit(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.RepositoryCommit, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryCommit - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.RepositoryCommit); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryCommit) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCommitRaw provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) GetCommitRaw(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 github.RawOptions) (string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, github.RawOptions) string); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r0 = ret.Get(0).(string) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, github.RawOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, github.RawOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCommitSHA1 provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) GetCommitSHA1(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 string) (string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) string); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r0 = ret.Get(0).(string) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetCommunityHealthMetrics provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetCommunityHealthMetrics(_a0 context.Context, _a1 string, _a2 string) (*github.CommunityHealthMetrics, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.CommunityHealthMetrics - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.CommunityHealthMetrics); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.CommunityHealthMetrics) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetContents provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) GetContents(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentGetOptions) (*github.RepositoryContent, []*github.RepositoryContent, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryContent - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) *github.RepositoryContent); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryContent) - } - } - - var r1 []*github.RepositoryContent - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) []*github.RepositoryContent); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).([]*github.RepositoryContent) - } - } - - var r2 *github.Response - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) *github.Response); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(2) != nil { - r2 = ret.Get(2).(*github.Response) - } - } - - var r3 error - if rf, ok := ret.Get(3).(func(context.Context, string, string, string, *github.RepositoryContentGetOptions) error); ok { - r3 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r3 = ret.Error(3) - } - - return r0, r1, r2, r3 -} - -// GetDeployment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetDeployment(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Deployment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Deployment - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Deployment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Deployment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetDeploymentStatus provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) GetDeploymentStatus(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 int64) (*github.DeploymentStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.DeploymentStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, int64) *github.DeploymentStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.DeploymentStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetEnvironment provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetEnvironment(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Environment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Environment - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Environment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Environment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Hook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetKey provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetKey(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Key - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Key); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetLatestPagesBuild provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetLatestPagesBuild(_a0 context.Context, _a1 string, _a2 string) (*github.PagesBuild, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.PagesBuild - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.PagesBuild); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PagesBuild) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetLatestRelease provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetLatestRelease(_a0 context.Context, _a1 string, _a2 string) (*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetPageBuild provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetPageBuild(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.PagesBuild, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.PagesBuild - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.PagesBuild); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PagesBuild) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetPagesInfo provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetPagesInfo(_a0 context.Context, _a1 string, _a2 string) (*github.Pages, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Pages - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.Pages); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Pages) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetPermissionLevel provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetPermissionLevel(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.RepositoryPermissionLevel, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryPermissionLevel - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.RepositoryPermissionLevel); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryPermissionLevel) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetPreReceiveHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetPreReceiveHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.PreReceiveHook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.PreReceiveHook - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.PreReceiveHook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PreReceiveHook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetPullRequestReviewEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetPullRequestReviewEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.PullRequestReviewsEnforcement, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.PullRequestReviewsEnforcement - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.PullRequestReviewsEnforcement); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PullRequestReviewsEnforcement) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetReadme provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetReadme(_a0 context.Context, _a1 string, _a2 string, _a3 *github.RepositoryContentGetOptions) (*github.RepositoryContent, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryContent - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.RepositoryContentGetOptions) *github.RepositoryContent); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryContent) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.RepositoryContentGetOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.RepositoryContentGetOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetRelease provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetRelease(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetReleaseAsset provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetReleaseAsset(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.ReleaseAsset, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.ReleaseAsset - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.ReleaseAsset); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ReleaseAsset) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetReleaseByTag provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetReleaseByTag(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetRequiredStatusChecks provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetRequiredStatusChecks(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.RequiredStatusChecks, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RequiredStatusChecks - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.RequiredStatusChecks); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RequiredStatusChecks) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetSignaturesProtectedBranch provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) GetSignaturesProtectedBranch(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.SignaturesProtectedBranch, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.SignaturesProtectedBranch - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.SignaturesProtectedBranch); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.SignaturesProtectedBranch) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetVulnerabilityAlerts provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) GetVulnerabilityAlerts(_a0 context.Context, _a1 string, _a2 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsCollaborator provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) IsCollaborator(_a0 context.Context, _a1 string, _a2 string, _a3 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// License provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) License(_a0 context.Context, _a1 string, _a2 string) (*github.RepositoryLicense, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.RepositoryLicense - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.RepositoryLicense); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryLicense) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// List provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) List(_a0 context.Context, _a1 string, _a2 *github.RepositoryListOptions) ([]*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, *github.RepositoryListOptions) []*github.Repository); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.RepositoryListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.RepositoryListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListAll provides a mock function with given fields: _a0, _a1 -func (_m *Repositories) ListAll(_a0 context.Context, _a1 *github.RepositoryListAllOptions) ([]*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.Repository - if rf, ok := ret.Get(0).(func(context.Context, *github.RepositoryListAllOptions) []*github.Repository); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.RepositoryListAllOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.RepositoryListAllOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListAllTopics provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListAllTopics(_a0 context.Context, _a1 string, _a2 string) ([]string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []string - if rf, ok := ret.Get(0).(func(context.Context, string, string) []string); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListApps provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListApps(_a0 context.Context, _a1 string, _a2 string, _a3 string) ([]*github.App, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.App - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) []*github.App); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.App) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListBranches provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListBranches(_a0 context.Context, _a1 string, _a2 string, _a3 *github.BranchListOptions) ([]*github.Branch, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Branch - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.BranchListOptions) []*github.Branch); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Branch) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.BranchListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.BranchListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListBranchesHeadCommit provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListBranchesHeadCommit(_a0 context.Context, _a1 string, _a2 string, _a3 string) ([]*github.BranchCommit, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.BranchCommit - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) []*github.BranchCommit); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.BranchCommit) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListByOrg provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListByOrg(_a0 context.Context, _a1 string, _a2 *github.RepositoryListByOrgOptions) ([]*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, *github.RepositoryListByOrgOptions) []*github.Repository); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.RepositoryListByOrgOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.RepositoryListByOrgOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListCodeFrequency provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListCodeFrequency(_a0 context.Context, _a1 string, _a2 string) ([]*github.WeeklyStats, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.WeeklyStats - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.WeeklyStats); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.WeeklyStats) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListCollaborators provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListCollaborators(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListCollaboratorsOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListCollaboratorsOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListCollaboratorsOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListComments provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListComments(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.RepositoryComment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.RepositoryComment - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.RepositoryComment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryComment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListCommitActivity provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListCommitActivity(_a0 context.Context, _a1 string, _a2 string) ([]*github.WeeklyCommitActivity, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.WeeklyCommitActivity - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.WeeklyCommitActivity); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.WeeklyCommitActivity) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListCommitComments provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) ListCommitComments(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.ListOptions) ([]*github.RepositoryComment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.RepositoryComment - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.ListOptions) []*github.RepositoryComment); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryComment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListCommits provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListCommits(_a0 context.Context, _a1 string, _a2 string, _a3 *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.RepositoryCommit - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.CommitsListOptions) []*github.RepositoryCommit); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryCommit) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.CommitsListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.CommitsListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListContributors provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListContributors(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListContributorsOptions) ([]*github.Contributor, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Contributor - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListContributorsOptions) []*github.Contributor); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Contributor) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListContributorsOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListContributorsOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListContributorsStats provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListContributorsStats(_a0 context.Context, _a1 string, _a2 string) ([]*github.ContributorStats, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.ContributorStats - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.ContributorStats); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.ContributorStats) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListDeploymentStatuses provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) ListDeploymentStatuses(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.ListOptions) ([]*github.DeploymentStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.DeploymentStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.ListOptions) []*github.DeploymentStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.DeploymentStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListDeployments provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListDeployments(_a0 context.Context, _a1 string, _a2 string, _a3 *github.DeploymentsListOptions) ([]*github.Deployment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Deployment - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.DeploymentsListOptions) []*github.Deployment); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Deployment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.DeploymentsListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.DeploymentsListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListEnvironments provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListEnvironments(_a0 context.Context, _a1 string, _a2 string) (*github.EnvResponse, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.EnvResponse - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.EnvResponse); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.EnvResponse) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListForks provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListForks(_a0 context.Context, _a1 string, _a2 string, _a3 *github.RepositoryListForksOptions) ([]*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.RepositoryListForksOptions) []*github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.RepositoryListForksOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.RepositoryListForksOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListHooks provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListHooks(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.Hook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Hook - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.Hook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Hook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListInvitations provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListInvitations(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.RepositoryInvitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.RepositoryInvitation - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.RepositoryInvitation); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryInvitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListKeys provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListKeys(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Key - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.Key); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListLanguages provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListLanguages(_a0 context.Context, _a1 string, _a2 string) (map[string]int, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 map[string]int - if rf, ok := ret.Get(0).(func(context.Context, string, string) map[string]int); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]int) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListPagesBuilds provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListPagesBuilds(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.PagesBuild, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.PagesBuild - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.PagesBuild); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.PagesBuild) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListParticipation provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListParticipation(_a0 context.Context, _a1 string, _a2 string) (*github.RepositoryParticipation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.RepositoryParticipation - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.RepositoryParticipation); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryParticipation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListPreReceiveHooks provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListPreReceiveHooks(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.PreReceiveHook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.PreReceiveHook - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.PreReceiveHook); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.PreReceiveHook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListProjects provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListProjects(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ProjectListOptions) ([]*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Project - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ProjectListOptions) []*github.Project); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ProjectListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ProjectListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListPunchCard provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListPunchCard(_a0 context.Context, _a1 string, _a2 string) ([]*github.PunchCard, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.PunchCard - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.PunchCard); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.PunchCard) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListReleaseAssets provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) ListReleaseAssets(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.ListOptions) ([]*github.ReleaseAsset, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.ReleaseAsset - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.ListOptions) []*github.ReleaseAsset); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.ReleaseAsset) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListReleases provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListReleases(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.RepositoryRelease - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.RepositoryRelease); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryRelease) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListRequiredStatusChecksContexts provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListRequiredStatusChecksContexts(_a0 context.Context, _a1 string, _a2 string, _a3 string) ([]string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []string - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) []string); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListStatuses provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) ListStatuses(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.ListOptions) ([]*github.RepoStatus, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.RepoStatus - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.ListOptions) []*github.RepoStatus); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepoStatus) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTags provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListTags(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.RepositoryTag - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.RepositoryTag); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryTag) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTeams provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListTeams(_a0 context.Context, _a1 string, _a2 string, _a3 *github.ListOptions) ([]*github.Team, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []*github.Team - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.ListOptions) []*github.Team); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Team) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTrafficClones provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListTrafficClones(_a0 context.Context, _a1 string, _a2 string, _a3 *github.TrafficBreakdownOptions) (*github.TrafficClones, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.TrafficClones - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.TrafficBreakdownOptions) *github.TrafficClones); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.TrafficClones) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.TrafficBreakdownOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.TrafficBreakdownOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTrafficPaths provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListTrafficPaths(_a0 context.Context, _a1 string, _a2 string) ([]*github.TrafficPath, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.TrafficPath - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.TrafficPath); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.TrafficPath) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTrafficReferrers provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) ListTrafficReferrers(_a0 context.Context, _a1 string, _a2 string) ([]*github.TrafficReferrer, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.TrafficReferrer - if rf, ok := ret.Get(0).(func(context.Context, string, string) []*github.TrafficReferrer); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.TrafficReferrer) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListTrafficViews provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ListTrafficViews(_a0 context.Context, _a1 string, _a2 string, _a3 *github.TrafficBreakdownOptions) (*github.TrafficViews, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.TrafficViews - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.TrafficBreakdownOptions) *github.TrafficViews); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.TrafficViews) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.TrafficBreakdownOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.TrafficBreakdownOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Merge provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) Merge(_a0 context.Context, _a1 string, _a2 string, _a3 *github.RepositoryMergeRequest) (*github.RepositoryCommit, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.RepositoryCommit - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.RepositoryMergeRequest) *github.RepositoryCommit); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryCommit) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.RepositoryMergeRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, *github.RepositoryMergeRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// OptionalSignaturesOnProtectedBranch provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) OptionalSignaturesOnProtectedBranch(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// PingHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) PingHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveAdminEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RemoveAdminEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveAppRestrictions provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) RemoveAppRestrictions(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 []string) ([]*github.App, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.App - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []string) []*github.App); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.App) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, []string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, []string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// RemoveBranchProtection provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RemoveBranchProtection(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveCollaborator provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RemoveCollaborator(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemovePullRequestReviewEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RemovePullRequestReviewEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveRequiredStatusChecks provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RemoveRequiredStatusChecks(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReplaceAllTopics provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) ReplaceAllTopics(_a0 context.Context, _a1 string, _a2 string, _a3 []string) ([]string, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 []string - if rf, ok := ret.Get(0).(func(context.Context, string, string, []string) []string); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, []string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, []string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ReplaceAppRestrictions provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) ReplaceAppRestrictions(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 []string) ([]*github.App, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 []*github.App - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []string) []*github.App); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.App) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, []string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, []string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// RequestPageBuild provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repositories) RequestPageBuild(_a0 context.Context, _a1 string, _a2 string) (*github.PagesBuild, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.PagesBuild - if rf, ok := ret.Get(0).(func(context.Context, string, string) *github.PagesBuild); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PagesBuild) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// RequireSignaturesOnProtectedBranch provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) RequireSignaturesOnProtectedBranch(_a0 context.Context, _a1 string, _a2 string, _a3 string) (*github.SignaturesProtectedBranch, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.SignaturesProtectedBranch - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *github.SignaturesProtectedBranch); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.SignaturesProtectedBranch) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// TestHook provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) TestHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Transfer provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) Transfer(_a0 context.Context, _a1 string, _a2 string, _a3 github.TransferRequest) (*github.Repository, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Repository - if rf, ok := ret.Get(0).(func(context.Context, string, string, github.TransferRequest) *github.Repository); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Repository) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, github.TransferRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, github.TransferRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdateBranchProtection provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdateBranchProtection(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.ProtectionRequest) (*github.Protection, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.Protection - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.ProtectionRequest) *github.Protection); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Protection) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.ProtectionRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.ProtectionRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdateComment provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdateComment(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryComment - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.RepositoryComment) *github.RepositoryComment); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryComment) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.RepositoryComment) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.RepositoryComment) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdateFile provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdateFile(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryContentResponse - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.RepositoryContentResponse); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryContentResponse) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RepositoryContentFileOptions) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdateInvitation provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdateInvitation(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 string) (*github.RepositoryInvitation, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RepositoryInvitation - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, string) *github.RepositoryInvitation); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RepositoryInvitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, string) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdatePages provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Repositories) UpdatePages(_a0 context.Context, _a1 string, _a2 string, _a3 *github.PagesUpdate) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, string, *github.PagesUpdate) *github.Response); ok { - r0 = rf(_a0, _a1, _a2, _a3) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, *github.PagesUpdate) error); ok { - r1 = rf(_a0, _a1, _a2, _a3) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdatePreReceiveHook provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdatePreReceiveHook(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.PreReceiveHook) (*github.PreReceiveHook, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.PreReceiveHook - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.PreReceiveHook) *github.PreReceiveHook); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PreReceiveHook) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.PreReceiveHook) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.PreReceiveHook) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdatePullRequestReviewEnforcement provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdatePullRequestReviewEnforcement(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.PullRequestReviewsEnforcementUpdate) (*github.PullRequestReviewsEnforcement, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.PullRequestReviewsEnforcement - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.PullRequestReviewsEnforcementUpdate) *github.PullRequestReviewsEnforcement); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.PullRequestReviewsEnforcement) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.PullRequestReviewsEnforcementUpdate) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.PullRequestReviewsEnforcementUpdate) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UpdateRequiredStatusChecks provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Repositories) UpdateRequiredStatusChecks(_a0 context.Context, _a1 string, _a2 string, _a3 string, _a4 *github.RequiredStatusChecksRequest) (*github.RequiredStatusChecks, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - - var r0 *github.RequiredStatusChecks - if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *github.RequiredStatusChecksRequest) *github.RequiredStatusChecks); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.RequiredStatusChecks) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *github.RequiredStatusChecksRequest) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *github.RequiredStatusChecksRequest) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// UploadReleaseAsset provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 -func (_m *Repositories) UploadReleaseAsset(_a0 context.Context, _a1 string, _a2 string, _a3 int64, _a4 *github.UploadOptions, _a5 *os.File) (*github.ReleaseAsset, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) - - var r0 *github.ReleaseAsset - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, *github.UploadOptions, *os.File) *github.ReleaseAsset); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.ReleaseAsset) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, *github.UploadOptions, *os.File) *github.Response); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, *github.UploadOptions, *os.File) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4, _a5) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} diff --git a/pkg/git/github/mocks/users.go b/pkg/git/github/mocks/users.go index df4e0b8c..55427747 100644 --- a/pkg/git/github/mocks/users.go +++ b/pkg/git/github/mocks/users.go @@ -1,983 +1,567 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./github/users.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" github "github.com/google/go-github/v35/github" - - mock "github.com/stretchr/testify/mock" ) -// Users is an autogenerated mock type for the Users type -type Users struct { - mock.Mock -} - -// AcceptInvitation provides a mock function with given fields: _a0, _a1 -func (_m *Users) AcceptInvitation(_a0 context.Context, _a1 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AddEmails provides a mock function with given fields: _a0, _a1 -func (_m *Users) AddEmails(_a0 context.Context, _a1 []string) ([]*github.UserEmail, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.UserEmail - if rf, ok := ret.Get(0).(func(context.Context, []string) []*github.UserEmail); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.UserEmail) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, []string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, []string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// BlockUser provides a mock function with given fields: _a0, _a1 -func (_m *Users) BlockUser(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateGPGKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) CreateGPGKey(_a0 context.Context, _a1 string) (*github.GPGKey, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.GPGKey - if rf, ok := ret.Get(0).(func(context.Context, string) *github.GPGKey); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.GPGKey) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) CreateKey(_a0 context.Context, _a1 *github.Key) (*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Key - if rf, ok := ret.Get(0).(func(context.Context, *github.Key) *github.Key); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.Key) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.Key) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateProject provides a mock function with given fields: _a0, _a1 -func (_m *Users) CreateProject(_a0 context.Context, _a1 *github.CreateUserProjectOptions) (*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Project - if rf, ok := ret.Get(0).(func(context.Context, *github.CreateUserProjectOptions) *github.Project); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.CreateUserProjectOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.CreateUserProjectOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// DeclineInvitation provides a mock function with given fields: _a0, _a1 -func (_m *Users) DeclineInvitation(_a0 context.Context, _a1 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteEmails provides a mock function with given fields: _a0, _a1 -func (_m *Users) DeleteEmails(_a0 context.Context, _a1 []string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, []string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, []string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteGPGKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) DeleteGPGKey(_a0 context.Context, _a1 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) DeleteKey(_a0 context.Context, _a1 int64) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DemoteSiteAdmin provides a mock function with given fields: _a0, _a1 -func (_m *Users) DemoteSiteAdmin(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Edit provides a mock function with given fields: _a0, _a1 -func (_m *Users) Edit(_a0 context.Context, _a1 *github.User) (*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.User - if rf, ok := ret.Get(0).(func(context.Context, *github.User) *github.User); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.User) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.User) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// Follow provides a mock function with given fields: _a0, _a1 -func (_m *Users) Follow(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Get provides a mock function with given fields: _a0, _a1 -func (_m *Users) Get(_a0 context.Context, _a1 string) (*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.User - if rf, ok := ret.Get(0).(func(context.Context, string) *github.User); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetByID provides a mock function with given fields: _a0, _a1 -func (_m *Users) GetByID(_a0 context.Context, _a1 int64) (*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.User - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.User); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, int64) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, int64) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetGPGKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) GetGPGKey(_a0 context.Context, _a1 int64) (*github.GPGKey, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.GPGKey - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.GPGKey); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.GPGKey) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, int64) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, int64) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetHovercard provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) GetHovercard(_a0 context.Context, _a1 string, _a2 *github.HovercardOptions) (*github.Hovercard, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Hovercard - if rf, ok := ret.Get(0).(func(context.Context, string, *github.HovercardOptions) *github.Hovercard); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Hovercard) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.HovercardOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.HovercardOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// GetKey provides a mock function with given fields: _a0, _a1 -func (_m *Users) GetKey(_a0 context.Context, _a1 int64) (*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Key - if rf, ok := ret.Get(0).(func(context.Context, int64) *github.Key); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, int64) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, int64) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsBlocked provides a mock function with given fields: _a0, _a1 -func (_m *Users) IsBlocked(_a0 context.Context, _a1 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// IsFollowing provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) IsFollowing(_a0 context.Context, _a1 string, _a2 string) (bool, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, string) bool); ok { - r0 = rf(_a0, _a1, _a2) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, string) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListAll provides a mock function with given fields: _a0, _a1 -func (_m *Users) ListAll(_a0 context.Context, _a1 *github.UserListOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, *github.UserListOptions) []*github.User); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.UserListOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.UserListOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListBlockedUsers provides a mock function with given fields: _a0, _a1 -func (_m *Users) ListBlockedUsers(_a0 context.Context, _a1 *github.ListOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, *github.ListOptions) []*github.User); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListEmails provides a mock function with given fields: _a0, _a1 -func (_m *Users) ListEmails(_a0 context.Context, _a1 *github.ListOptions) ([]*github.UserEmail, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.UserEmail - if rf, ok := ret.Get(0).(func(context.Context, *github.ListOptions) []*github.UserEmail); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.UserEmail) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListFollowers provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) ListFollowers(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListFollowing provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) ListFollowing(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.User, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.User - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.User); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.User) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListGPGKeys provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) ListGPGKeys(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.GPGKey, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.GPGKey - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.GPGKey); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.GPGKey) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListInvitations provides a mock function with given fields: _a0, _a1 -func (_m *Users) ListInvitations(_a0 context.Context, _a1 *github.ListOptions) ([]*github.RepositoryInvitation, *github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 []*github.RepositoryInvitation - if rf, ok := ret.Get(0).(func(context.Context, *github.ListOptions) []*github.RepositoryInvitation); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.RepositoryInvitation) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListKeys provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) ListKeys(_a0 context.Context, _a1 string, _a2 *github.ListOptions) ([]*github.Key, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Key - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ListOptions) []*github.Key); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Key) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListProjects provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) ListProjects(_a0 context.Context, _a1 string, _a2 *github.ProjectListOptions) ([]*github.Project, *github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 []*github.Project - if rf, ok := ret.Get(0).(func(context.Context, string, *github.ProjectListOptions) []*github.Project); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*github.Project) - } - } - - var r1 *github.Response - if rf, ok := ret.Get(1).(func(context.Context, string, *github.ProjectListOptions) *github.Response); ok { - r1 = rf(_a0, _a1, _a2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*github.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, *github.ProjectListOptions) error); ok { - r2 = rf(_a0, _a1, _a2) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// PromoteSiteAdmin provides a mock function with given fields: _a0, _a1 -func (_m *Users) PromoteSiteAdmin(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Suspend provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Users) Suspend(_a0 context.Context, _a1 string, _a2 *github.UserSuspendOptions) (*github.Response, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string, *github.UserSuspendOptions) *github.Response); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, *github.UserSuspendOptions) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UnblockUser provides a mock function with given fields: _a0, _a1 -func (_m *Users) UnblockUser(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Unfollow provides a mock function with given fields: _a0, _a1 -func (_m *Users) Unfollow(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Unsuspend provides a mock function with given fields: _a0, _a1 -func (_m *Users) Unsuspend(_a0 context.Context, _a1 string) (*github.Response, error) { - ret := _m.Called(_a0, _a1) - - var r0 *github.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *github.Response); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*github.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// MockUsers is a mock of Users interface. +type MockUsers struct { + ctrl *gomock.Controller + recorder *MockUsersMockRecorder +} + +// MockUsersMockRecorder is the mock recorder for MockUsers. +type MockUsersMockRecorder struct { + mock *MockUsers +} + +// NewMockUsers creates a new mock instance. +func NewMockUsers(ctrl *gomock.Controller) *MockUsers { + mock := &MockUsers{ctrl: ctrl} + mock.recorder = &MockUsersMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockUsers) EXPECT() *MockUsersMockRecorder { + return m.recorder +} + +// AcceptInvitation mocks base method. +func (m *MockUsers) AcceptInvitation(arg0 context.Context, arg1 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AcceptInvitation", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AcceptInvitation indicates an expected call of AcceptInvitation. +func (mr *MockUsersMockRecorder) AcceptInvitation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptInvitation", reflect.TypeOf((*MockUsers)(nil).AcceptInvitation), arg0, arg1) +} + +// AddEmails mocks base method. +func (m *MockUsers) AddEmails(arg0 context.Context, arg1 []string) ([]*github.UserEmail, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddEmails", arg0, arg1) + ret0, _ := ret[0].([]*github.UserEmail) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// AddEmails indicates an expected call of AddEmails. +func (mr *MockUsersMockRecorder) AddEmails(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEmails", reflect.TypeOf((*MockUsers)(nil).AddEmails), arg0, arg1) +} + +// BlockUser mocks base method. +func (m *MockUsers) BlockUser(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlockUser", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BlockUser indicates an expected call of BlockUser. +func (mr *MockUsersMockRecorder) BlockUser(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockUser", reflect.TypeOf((*MockUsers)(nil).BlockUser), arg0, arg1) +} + +// CreateGPGKey mocks base method. +func (m *MockUsers) CreateGPGKey(arg0 context.Context, arg1 string) (*github.GPGKey, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateGPGKey", arg0, arg1) + ret0, _ := ret[0].(*github.GPGKey) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateGPGKey indicates an expected call of CreateGPGKey. +func (mr *MockUsersMockRecorder) CreateGPGKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGPGKey", reflect.TypeOf((*MockUsers)(nil).CreateGPGKey), arg0, arg1) +} + +// CreateKey mocks base method. +func (m *MockUsers) CreateKey(arg0 context.Context, arg1 *github.Key) (*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateKey", arg0, arg1) + ret0, _ := ret[0].(*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateKey indicates an expected call of CreateKey. +func (mr *MockUsersMockRecorder) CreateKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateKey", reflect.TypeOf((*MockUsers)(nil).CreateKey), arg0, arg1) +} + +// CreateProject mocks base method. +func (m *MockUsers) CreateProject(arg0 context.Context, arg1 *github.CreateUserProjectOptions) (*github.Project, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateProject", arg0, arg1) + ret0, _ := ret[0].(*github.Project) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateProject indicates an expected call of CreateProject. +func (mr *MockUsersMockRecorder) CreateProject(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProject", reflect.TypeOf((*MockUsers)(nil).CreateProject), arg0, arg1) +} + +// DeclineInvitation mocks base method. +func (m *MockUsers) DeclineInvitation(arg0 context.Context, arg1 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeclineInvitation", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeclineInvitation indicates an expected call of DeclineInvitation. +func (mr *MockUsersMockRecorder) DeclineInvitation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeclineInvitation", reflect.TypeOf((*MockUsers)(nil).DeclineInvitation), arg0, arg1) +} + +// DeleteEmails mocks base method. +func (m *MockUsers) DeleteEmails(arg0 context.Context, arg1 []string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteEmails", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteEmails indicates an expected call of DeleteEmails. +func (mr *MockUsersMockRecorder) DeleteEmails(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteEmails", reflect.TypeOf((*MockUsers)(nil).DeleteEmails), arg0, arg1) +} + +// DeleteGPGKey mocks base method. +func (m *MockUsers) DeleteGPGKey(arg0 context.Context, arg1 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGPGKey", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteGPGKey indicates an expected call of DeleteGPGKey. +func (mr *MockUsersMockRecorder) DeleteGPGKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGPGKey", reflect.TypeOf((*MockUsers)(nil).DeleteGPGKey), arg0, arg1) +} + +// DeleteKey mocks base method. +func (m *MockUsers) DeleteKey(arg0 context.Context, arg1 int64) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteKey", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteKey indicates an expected call of DeleteKey. +func (mr *MockUsersMockRecorder) DeleteKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteKey", reflect.TypeOf((*MockUsers)(nil).DeleteKey), arg0, arg1) +} + +// DemoteSiteAdmin mocks base method. +func (m *MockUsers) DemoteSiteAdmin(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DemoteSiteAdmin", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DemoteSiteAdmin indicates an expected call of DemoteSiteAdmin. +func (mr *MockUsersMockRecorder) DemoteSiteAdmin(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DemoteSiteAdmin", reflect.TypeOf((*MockUsers)(nil).DemoteSiteAdmin), arg0, arg1) +} + +// Edit mocks base method. +func (m *MockUsers) Edit(arg0 context.Context, arg1 *github.User) (*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Edit", arg0, arg1) + ret0, _ := ret[0].(*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Edit indicates an expected call of Edit. +func (mr *MockUsersMockRecorder) Edit(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Edit", reflect.TypeOf((*MockUsers)(nil).Edit), arg0, arg1) +} + +// Follow mocks base method. +func (m *MockUsers) Follow(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Follow", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Follow indicates an expected call of Follow. +func (mr *MockUsersMockRecorder) Follow(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Follow", reflect.TypeOf((*MockUsers)(nil).Follow), arg0, arg1) +} + +// Get mocks base method. +func (m *MockUsers) Get(arg0 context.Context, arg1 string) (*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1) + ret0, _ := ret[0].(*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// Get indicates an expected call of Get. +func (mr *MockUsersMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockUsers)(nil).Get), arg0, arg1) +} + +// GetByID mocks base method. +func (m *MockUsers) GetByID(arg0 context.Context, arg1 int64) (*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetByID", arg0, arg1) + ret0, _ := ret[0].(*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetByID indicates an expected call of GetByID. +func (mr *MockUsersMockRecorder) GetByID(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockUsers)(nil).GetByID), arg0, arg1) +} + +// GetGPGKey mocks base method. +func (m *MockUsers) GetGPGKey(arg0 context.Context, arg1 int64) (*github.GPGKey, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGPGKey", arg0, arg1) + ret0, _ := ret[0].(*github.GPGKey) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetGPGKey indicates an expected call of GetGPGKey. +func (mr *MockUsersMockRecorder) GetGPGKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGPGKey", reflect.TypeOf((*MockUsers)(nil).GetGPGKey), arg0, arg1) +} + +// GetHovercard mocks base method. +func (m *MockUsers) GetHovercard(arg0 context.Context, arg1 string, arg2 *github.HovercardOptions) (*github.Hovercard, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHovercard", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Hovercard) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetHovercard indicates an expected call of GetHovercard. +func (mr *MockUsersMockRecorder) GetHovercard(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHovercard", reflect.TypeOf((*MockUsers)(nil).GetHovercard), arg0, arg1, arg2) +} + +// GetKey mocks base method. +func (m *MockUsers) GetKey(arg0 context.Context, arg1 int64) (*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetKey", arg0, arg1) + ret0, _ := ret[0].(*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetKey indicates an expected call of GetKey. +func (mr *MockUsersMockRecorder) GetKey(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetKey", reflect.TypeOf((*MockUsers)(nil).GetKey), arg0, arg1) +} + +// IsBlocked mocks base method. +func (m *MockUsers) IsBlocked(arg0 context.Context, arg1 string) (bool, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsBlocked", arg0, arg1) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// IsBlocked indicates an expected call of IsBlocked. +func (mr *MockUsersMockRecorder) IsBlocked(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBlocked", reflect.TypeOf((*MockUsers)(nil).IsBlocked), arg0, arg1) +} + +// IsFollowing mocks base method. +func (m *MockUsers) IsFollowing(arg0 context.Context, arg1, arg2 string) (bool, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsFollowing", arg0, arg1, arg2) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// IsFollowing indicates an expected call of IsFollowing. +func (mr *MockUsersMockRecorder) IsFollowing(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsFollowing", reflect.TypeOf((*MockUsers)(nil).IsFollowing), arg0, arg1, arg2) +} + +// ListAll mocks base method. +func (m *MockUsers) ListAll(arg0 context.Context, arg1 *github.UserListOptions) ([]*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAll", arg0, arg1) + ret0, _ := ret[0].([]*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListAll indicates an expected call of ListAll. +func (mr *MockUsersMockRecorder) ListAll(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAll", reflect.TypeOf((*MockUsers)(nil).ListAll), arg0, arg1) +} + +// ListBlockedUsers mocks base method. +func (m *MockUsers) ListBlockedUsers(arg0 context.Context, arg1 *github.ListOptions) ([]*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListBlockedUsers", arg0, arg1) + ret0, _ := ret[0].([]*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListBlockedUsers indicates an expected call of ListBlockedUsers. +func (mr *MockUsersMockRecorder) ListBlockedUsers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBlockedUsers", reflect.TypeOf((*MockUsers)(nil).ListBlockedUsers), arg0, arg1) +} + +// ListEmails mocks base method. +func (m *MockUsers) ListEmails(arg0 context.Context, arg1 *github.ListOptions) ([]*github.UserEmail, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListEmails", arg0, arg1) + ret0, _ := ret[0].([]*github.UserEmail) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListEmails indicates an expected call of ListEmails. +func (mr *MockUsersMockRecorder) ListEmails(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEmails", reflect.TypeOf((*MockUsers)(nil).ListEmails), arg0, arg1) +} + +// ListFollowers mocks base method. +func (m *MockUsers) ListFollowers(arg0 context.Context, arg1 string, arg2 *github.ListOptions) ([]*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListFollowers", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListFollowers indicates an expected call of ListFollowers. +func (mr *MockUsersMockRecorder) ListFollowers(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListFollowers", reflect.TypeOf((*MockUsers)(nil).ListFollowers), arg0, arg1, arg2) +} + +// ListFollowing mocks base method. +func (m *MockUsers) ListFollowing(arg0 context.Context, arg1 string, arg2 *github.ListOptions) ([]*github.User, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListFollowing", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.User) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListFollowing indicates an expected call of ListFollowing. +func (mr *MockUsersMockRecorder) ListFollowing(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListFollowing", reflect.TypeOf((*MockUsers)(nil).ListFollowing), arg0, arg1, arg2) +} + +// ListGPGKeys mocks base method. +func (m *MockUsers) ListGPGKeys(arg0 context.Context, arg1 string, arg2 *github.ListOptions) ([]*github.GPGKey, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGPGKeys", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.GPGKey) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListGPGKeys indicates an expected call of ListGPGKeys. +func (mr *MockUsersMockRecorder) ListGPGKeys(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGPGKeys", reflect.TypeOf((*MockUsers)(nil).ListGPGKeys), arg0, arg1, arg2) +} + +// ListInvitations mocks base method. +func (m *MockUsers) ListInvitations(arg0 context.Context, arg1 *github.ListOptions) ([]*github.RepositoryInvitation, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInvitations", arg0, arg1) + ret0, _ := ret[0].([]*github.RepositoryInvitation) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListInvitations indicates an expected call of ListInvitations. +func (mr *MockUsersMockRecorder) ListInvitations(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInvitations", reflect.TypeOf((*MockUsers)(nil).ListInvitations), arg0, arg1) +} + +// ListKeys mocks base method. +func (m *MockUsers) ListKeys(arg0 context.Context, arg1 string, arg2 *github.ListOptions) ([]*github.Key, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListKeys", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.Key) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListKeys indicates an expected call of ListKeys. +func (mr *MockUsersMockRecorder) ListKeys(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListKeys", reflect.TypeOf((*MockUsers)(nil).ListKeys), arg0, arg1, arg2) +} + +// ListProjects mocks base method. +func (m *MockUsers) ListProjects(arg0 context.Context, arg1 string, arg2 *github.ProjectListOptions) ([]*github.Project, *github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListProjects", arg0, arg1, arg2) + ret0, _ := ret[0].([]*github.Project) + ret1, _ := ret[1].(*github.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListProjects indicates an expected call of ListProjects. +func (mr *MockUsersMockRecorder) ListProjects(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListProjects", reflect.TypeOf((*MockUsers)(nil).ListProjects), arg0, arg1, arg2) +} + +// PromoteSiteAdmin mocks base method. +func (m *MockUsers) PromoteSiteAdmin(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PromoteSiteAdmin", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PromoteSiteAdmin indicates an expected call of PromoteSiteAdmin. +func (mr *MockUsersMockRecorder) PromoteSiteAdmin(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromoteSiteAdmin", reflect.TypeOf((*MockUsers)(nil).PromoteSiteAdmin), arg0, arg1) +} + +// Suspend mocks base method. +func (m *MockUsers) Suspend(arg0 context.Context, arg1 string, arg2 *github.UserSuspendOptions) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Suspend", arg0, arg1, arg2) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Suspend indicates an expected call of Suspend. +func (mr *MockUsersMockRecorder) Suspend(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Suspend", reflect.TypeOf((*MockUsers)(nil).Suspend), arg0, arg1, arg2) +} + +// UnblockUser mocks base method. +func (m *MockUsers) UnblockUser(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UnblockUser", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UnblockUser indicates an expected call of UnblockUser. +func (mr *MockUsersMockRecorder) UnblockUser(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnblockUser", reflect.TypeOf((*MockUsers)(nil).UnblockUser), arg0, arg1) +} + +// Unfollow mocks base method. +func (m *MockUsers) Unfollow(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Unfollow", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Unfollow indicates an expected call of Unfollow. +func (mr *MockUsersMockRecorder) Unfollow(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unfollow", reflect.TypeOf((*MockUsers)(nil).Unfollow), arg0, arg1) +} + +// Unsuspend mocks base method. +func (m *MockUsers) Unsuspend(arg0 context.Context, arg1 string) (*github.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Unsuspend", arg0, arg1) + ret0, _ := ret[0].(*github.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Unsuspend indicates an expected call of Unsuspend. +func (mr *MockUsersMockRecorder) Unsuspend(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unsuspend", reflect.TypeOf((*MockUsers)(nil).Unsuspend), arg0, arg1) } diff --git a/pkg/git/gitlab/mocks/client.go b/pkg/git/gitlab/mocks/client.go new file mode 100644 index 00000000..197d2020 --- /dev/null +++ b/pkg/git/gitlab/mocks/client.go @@ -0,0 +1,97 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./provider_gitlab.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + gitlab "github.com/xanzy/go-gitlab" +) + +// MockGitlabClient is a mock of GitlabClient interface. +type MockGitlabClient struct { + ctrl *gomock.Controller + recorder *MockGitlabClientMockRecorder +} + +// MockGitlabClientMockRecorder is the mock recorder for MockGitlabClient. +type MockGitlabClientMockRecorder struct { + mock *MockGitlabClient +} + +// NewMockGitlabClient creates a new mock instance. +func NewMockGitlabClient(ctrl *gomock.Controller) *MockGitlabClient { + mock := &MockGitlabClient{ctrl: ctrl} + mock.recorder = &MockGitlabClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGitlabClient) EXPECT() *MockGitlabClientMockRecorder { + return m.recorder +} + +// CreateProject mocks base method. +func (m *MockGitlabClient) CreateProject(opt *gitlab.CreateProjectOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Project, *gitlab.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{opt} + for _, a := range options { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateProject", varargs...) + ret0, _ := ret[0].(*gitlab.Project) + ret1, _ := ret[1].(*gitlab.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateProject indicates an expected call of CreateProject. +func (mr *MockGitlabClientMockRecorder) CreateProject(opt interface{}, options ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{opt}, options...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProject", reflect.TypeOf((*MockGitlabClient)(nil).CreateProject), varargs...) +} + +// CurrentUser mocks base method. +func (m *MockGitlabClient) CurrentUser(options ...gitlab.RequestOptionFunc) (*gitlab.User, *gitlab.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range options { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CurrentUser", varargs...) + ret0, _ := ret[0].(*gitlab.User) + ret1, _ := ret[1].(*gitlab.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CurrentUser indicates an expected call of CurrentUser. +func (mr *MockGitlabClientMockRecorder) CurrentUser(options ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentUser", reflect.TypeOf((*MockGitlabClient)(nil).CurrentUser), options...) +} + +// ListGroups mocks base method. +func (m *MockGitlabClient) ListGroups(opt *gitlab.ListGroupsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Group, *gitlab.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{opt} + for _, a := range options { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroups", varargs...) + ret0, _ := ret[0].([]*gitlab.Group) + ret1, _ := ret[1].(*gitlab.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListGroups indicates an expected call of ListGroups. +func (mr *MockGitlabClientMockRecorder) ListGroups(opt interface{}, options ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{opt}, options...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroups", reflect.TypeOf((*MockGitlabClient)(nil).ListGroups), varargs...) +} diff --git a/pkg/git/gitlab/mocks/gitlab_client.go b/pkg/git/gitlab/mocks/gitlab_client.go deleted file mode 100644 index c8336c7d..00000000 --- a/pkg/git/gitlab/mocks/gitlab_client.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by mockery (devel). DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - gitlab "github.com/xanzy/go-gitlab" -) - -// GitlabClient is an autogenerated mock type for the GitlabClient type -type GitlabClient struct { - mock.Mock -} - -// CreateProject provides a mock function with given fields: opt, options -func (_m *GitlabClient) CreateProject(opt *gitlab.CreateProjectOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Project, *gitlab.Response, error) { - _va := make([]interface{}, len(options)) - for _i := range options { - _va[_i] = options[_i] - } - var _ca []interface{} - _ca = append(_ca, opt) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *gitlab.Project - if rf, ok := ret.Get(0).(func(*gitlab.CreateProjectOptions, ...gitlab.RequestOptionFunc) *gitlab.Project); ok { - r0 = rf(opt, options...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*gitlab.Project) - } - } - - var r1 *gitlab.Response - if rf, ok := ret.Get(1).(func(*gitlab.CreateProjectOptions, ...gitlab.RequestOptionFunc) *gitlab.Response); ok { - r1 = rf(opt, options...) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitlab.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(*gitlab.CreateProjectOptions, ...gitlab.RequestOptionFunc) error); ok { - r2 = rf(opt, options...) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CurrentUser provides a mock function with given fields: options -func (_m *GitlabClient) CurrentUser(options ...gitlab.RequestOptionFunc) (*gitlab.User, *gitlab.Response, error) { - _va := make([]interface{}, len(options)) - for _i := range options { - _va[_i] = options[_i] - } - var _ca []interface{} - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *gitlab.User - if rf, ok := ret.Get(0).(func(...gitlab.RequestOptionFunc) *gitlab.User); ok { - r0 = rf(options...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*gitlab.User) - } - } - - var r1 *gitlab.Response - if rf, ok := ret.Get(1).(func(...gitlab.RequestOptionFunc) *gitlab.Response); ok { - r1 = rf(options...) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitlab.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(...gitlab.RequestOptionFunc) error); ok { - r2 = rf(options...) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListGroups provides a mock function with given fields: opt, options -func (_m *GitlabClient) ListGroups(opt *gitlab.ListGroupsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Group, *gitlab.Response, error) { - _va := make([]interface{}, len(options)) - for _i := range options { - _va[_i] = options[_i] - } - var _ca []interface{} - _ca = append(_ca, opt) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 []*gitlab.Group - if rf, ok := ret.Get(0).(func(*gitlab.ListGroupsOptions, ...gitlab.RequestOptionFunc) []*gitlab.Group); ok { - r0 = rf(opt, options...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*gitlab.Group) - } - } - - var r1 *gitlab.Response - if rf, ok := ret.Get(1).(func(*gitlab.ListGroupsOptions, ...gitlab.RequestOptionFunc) *gitlab.Response); ok { - r1 = rf(opt, options...) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*gitlab.Response) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(*gitlab.ListGroupsOptions, ...gitlab.RequestOptionFunc) error); ok { - r2 = rf(opt, options...) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} diff --git a/pkg/git/gogit/mocks/repository.go b/pkg/git/gogit/mocks/repository.go index c043b83e..545cb557 100644 --- a/pkg/git/gogit/mocks/repository.go +++ b/pkg/git/gogit/mocks/repository.go @@ -1,836 +1,628 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./gogit/repo.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" + git "github.com/go-git/go-git/v5" config "github.com/go-git/go-git/v5/config" + plumbing "github.com/go-git/go-git/v5/plumbing" + object "github.com/go-git/go-git/v5/plumbing/object" + storer "github.com/go-git/go-git/v5/plumbing/storer" + gomock "github.com/golang/mock/gomock" +) - git "github.com/go-git/go-git/v5" +// MockRepository is a mock of Repository interface. +type MockRepository struct { + ctrl *gomock.Controller + recorder *MockRepositoryMockRecorder +} - mock "github.com/stretchr/testify/mock" +// MockRepositoryMockRecorder is the mock recorder for MockRepository. +type MockRepositoryMockRecorder struct { + mock *MockRepository +} - object "github.com/go-git/go-git/v5/plumbing/object" +// NewMockRepository creates a new mock instance. +func NewMockRepository(ctrl *gomock.Controller) *MockRepository { + mock := &MockRepository{ctrl: ctrl} + mock.recorder = &MockRepositoryMockRecorder{mock} + return mock +} - plumbing "github.com/go-git/go-git/v5/plumbing" +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { + return m.recorder +} - storer "github.com/go-git/go-git/v5/plumbing/storer" -) +// BlobObject mocks base method. +func (m *MockRepository) BlobObject(arg0 plumbing.Hash) (*object.Blob, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlobObject", arg0) + ret0, _ := ret[0].(*object.Blob) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BlobObject indicates an expected call of BlobObject. +func (mr *MockRepositoryMockRecorder) BlobObject(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlobObject", reflect.TypeOf((*MockRepository)(nil).BlobObject), arg0) +} + +// BlobObjects mocks base method. +func (m *MockRepository) BlobObjects() (*object.BlobIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BlobObjects") + ret0, _ := ret[0].(*object.BlobIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BlobObjects indicates an expected call of BlobObjects. +func (mr *MockRepositoryMockRecorder) BlobObjects() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlobObjects", reflect.TypeOf((*MockRepository)(nil).BlobObjects)) +} + +// Branch mocks base method. +func (m *MockRepository) Branch(arg0 string) (*config.Branch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Branch", arg0) + ret0, _ := ret[0].(*config.Branch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Branch indicates an expected call of Branch. +func (mr *MockRepositoryMockRecorder) Branch(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Branch", reflect.TypeOf((*MockRepository)(nil).Branch), arg0) +} + +// Branches mocks base method. +func (m *MockRepository) Branches() (storer.ReferenceIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Branches") + ret0, _ := ret[0].(storer.ReferenceIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Branches indicates an expected call of Branches. +func (mr *MockRepositoryMockRecorder) Branches() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Branches", reflect.TypeOf((*MockRepository)(nil).Branches)) +} + +// CommitObject mocks base method. +func (m *MockRepository) CommitObject(arg0 plumbing.Hash) (*object.Commit, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitObject", arg0) + ret0, _ := ret[0].(*object.Commit) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitObject indicates an expected call of CommitObject. +func (mr *MockRepositoryMockRecorder) CommitObject(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitObject", reflect.TypeOf((*MockRepository)(nil).CommitObject), arg0) +} + +// CommitObjects mocks base method. +func (m *MockRepository) CommitObjects() (object.CommitIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitObjects") + ret0, _ := ret[0].(object.CommitIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitObjects indicates an expected call of CommitObjects. +func (mr *MockRepositoryMockRecorder) CommitObjects() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitObjects", reflect.TypeOf((*MockRepository)(nil).CommitObjects)) +} + +// Config mocks base method. +func (m *MockRepository) Config() (*config.Config, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Config") + ret0, _ := ret[0].(*config.Config) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Config indicates an expected call of Config. +func (mr *MockRepositoryMockRecorder) Config() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Config", reflect.TypeOf((*MockRepository)(nil).Config)) +} + +// ConfigScoped mocks base method. +func (m *MockRepository) ConfigScoped(arg0 config.Scope) (*config.Config, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigScoped", arg0) + ret0, _ := ret[0].(*config.Config) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ConfigScoped indicates an expected call of ConfigScoped. +func (mr *MockRepositoryMockRecorder) ConfigScoped(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigScoped", reflect.TypeOf((*MockRepository)(nil).ConfigScoped), arg0) +} + +// CreateBranch mocks base method. +func (m *MockRepository) CreateBranch(arg0 *config.Branch) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateBranch", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// CreateBranch indicates an expected call of CreateBranch. +func (mr *MockRepositoryMockRecorder) CreateBranch(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBranch", reflect.TypeOf((*MockRepository)(nil).CreateBranch), arg0) +} + +// CreateRemote mocks base method. +func (m *MockRepository) CreateRemote(arg0 *config.RemoteConfig) (*git.Remote, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRemote", arg0) + ret0, _ := ret[0].(*git.Remote) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRemote indicates an expected call of CreateRemote. +func (mr *MockRepositoryMockRecorder) CreateRemote(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRemote", reflect.TypeOf((*MockRepository)(nil).CreateRemote), arg0) +} + +// CreateRemoteAnonymous mocks base method. +func (m *MockRepository) CreateRemoteAnonymous(arg0 *config.RemoteConfig) (*git.Remote, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRemoteAnonymous", arg0) + ret0, _ := ret[0].(*git.Remote) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRemoteAnonymous indicates an expected call of CreateRemoteAnonymous. +func (mr *MockRepositoryMockRecorder) CreateRemoteAnonymous(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRemoteAnonymous", reflect.TypeOf((*MockRepository)(nil).CreateRemoteAnonymous), arg0) +} + +// CreateTag mocks base method. +func (m *MockRepository) CreateTag(arg0 string, arg1 plumbing.Hash, arg2 *git.CreateTagOptions) (*plumbing.Reference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTag", arg0, arg1, arg2) + ret0, _ := ret[0].(*plumbing.Reference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateTag indicates an expected call of CreateTag. +func (mr *MockRepositoryMockRecorder) CreateTag(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTag", reflect.TypeOf((*MockRepository)(nil).CreateTag), arg0, arg1, arg2) +} + +// DeleteBranch mocks base method. +func (m *MockRepository) DeleteBranch(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteBranch", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteBranch indicates an expected call of DeleteBranch. +func (mr *MockRepositoryMockRecorder) DeleteBranch(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBranch", reflect.TypeOf((*MockRepository)(nil).DeleteBranch), arg0) +} + +// DeleteObject mocks base method. +func (m *MockRepository) DeleteObject(arg0 plumbing.Hash) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteObject", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteObject indicates an expected call of DeleteObject. +func (mr *MockRepositoryMockRecorder) DeleteObject(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockRepository)(nil).DeleteObject), arg0) +} + +// DeleteRemote mocks base method. +func (m *MockRepository) DeleteRemote(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRemote", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteRemote indicates an expected call of DeleteRemote. +func (mr *MockRepositoryMockRecorder) DeleteRemote(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRemote", reflect.TypeOf((*MockRepository)(nil).DeleteRemote), arg0) +} + +// DeleteTag mocks base method. +func (m *MockRepository) DeleteTag(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTag", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteTag indicates an expected call of DeleteTag. +func (mr *MockRepositoryMockRecorder) DeleteTag(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTag", reflect.TypeOf((*MockRepository)(nil).DeleteTag), arg0) +} + +// Fetch mocks base method. +func (m *MockRepository) Fetch(arg0 *git.FetchOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Fetch", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Fetch indicates an expected call of Fetch. +func (mr *MockRepositoryMockRecorder) Fetch(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Fetch", reflect.TypeOf((*MockRepository)(nil).Fetch), arg0) +} + +// FetchContext mocks base method. +func (m *MockRepository) FetchContext(arg0 context.Context, arg1 *git.FetchOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FetchContext", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// FetchContext indicates an expected call of FetchContext. +func (mr *MockRepositoryMockRecorder) FetchContext(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchContext", reflect.TypeOf((*MockRepository)(nil).FetchContext), arg0, arg1) +} + +// Head mocks base method. +func (m *MockRepository) Head() (*plumbing.Reference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Head") + ret0, _ := ret[0].(*plumbing.Reference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Head indicates an expected call of Head. +func (mr *MockRepositoryMockRecorder) Head() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Head", reflect.TypeOf((*MockRepository)(nil).Head)) +} + +// Log mocks base method. +func (m *MockRepository) Log(arg0 *git.LogOptions) (object.CommitIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Log", arg0) + ret0, _ := ret[0].(object.CommitIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Log indicates an expected call of Log. +func (mr *MockRepositoryMockRecorder) Log(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Log", reflect.TypeOf((*MockRepository)(nil).Log), arg0) +} + +// Notes mocks base method. +func (m *MockRepository) Notes() (storer.ReferenceIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Notes") + ret0, _ := ret[0].(storer.ReferenceIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Notes indicates an expected call of Notes. +func (mr *MockRepositoryMockRecorder) Notes() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Notes", reflect.TypeOf((*MockRepository)(nil).Notes)) +} + +// Object mocks base method. +func (m *MockRepository) Object(arg0 plumbing.ObjectType, arg1 plumbing.Hash) (object.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Object", arg0, arg1) + ret0, _ := ret[0].(object.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Object indicates an expected call of Object. +func (mr *MockRepositoryMockRecorder) Object(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Object", reflect.TypeOf((*MockRepository)(nil).Object), arg0, arg1) +} + +// Objects mocks base method. +func (m *MockRepository) Objects() (*object.ObjectIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Objects") + ret0, _ := ret[0].(*object.ObjectIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Objects indicates an expected call of Objects. +func (mr *MockRepositoryMockRecorder) Objects() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Objects", reflect.TypeOf((*MockRepository)(nil).Objects)) +} + +// Prune mocks base method. +func (m *MockRepository) Prune(arg0 git.PruneOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Prune", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Prune indicates an expected call of Prune. +func (mr *MockRepositoryMockRecorder) Prune(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prune", reflect.TypeOf((*MockRepository)(nil).Prune), arg0) +} + +// Push mocks base method. +func (m *MockRepository) Push(arg0 *git.PushOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Push", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Push indicates an expected call of Push. +func (mr *MockRepositoryMockRecorder) Push(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Push", reflect.TypeOf((*MockRepository)(nil).Push), arg0) +} + +// PushContext mocks base method. +func (m *MockRepository) PushContext(arg0 context.Context, arg1 *git.PushOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PushContext", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// PushContext indicates an expected call of PushContext. +func (mr *MockRepositoryMockRecorder) PushContext(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PushContext", reflect.TypeOf((*MockRepository)(nil).PushContext), arg0, arg1) +} + +// Reference mocks base method. +func (m *MockRepository) Reference(arg0 plumbing.ReferenceName, arg1 bool) (*plumbing.Reference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Reference", arg0, arg1) + ret0, _ := ret[0].(*plumbing.Reference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Reference indicates an expected call of Reference. +func (mr *MockRepositoryMockRecorder) Reference(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reference", reflect.TypeOf((*MockRepository)(nil).Reference), arg0, arg1) +} + +// References mocks base method. +func (m *MockRepository) References() (storer.ReferenceIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "References") + ret0, _ := ret[0].(storer.ReferenceIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// References indicates an expected call of References. +func (mr *MockRepositoryMockRecorder) References() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "References", reflect.TypeOf((*MockRepository)(nil).References)) +} + +// Remote mocks base method. +func (m *MockRepository) Remote(arg0 string) (*git.Remote, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Remote", arg0) + ret0, _ := ret[0].(*git.Remote) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Remote indicates an expected call of Remote. +func (mr *MockRepositoryMockRecorder) Remote(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remote", reflect.TypeOf((*MockRepository)(nil).Remote), arg0) +} + +// Remotes mocks base method. +func (m *MockRepository) Remotes() ([]*git.Remote, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Remotes") + ret0, _ := ret[0].([]*git.Remote) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Remotes indicates an expected call of Remotes. +func (mr *MockRepositoryMockRecorder) Remotes() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remotes", reflect.TypeOf((*MockRepository)(nil).Remotes)) +} -// Repository is an autogenerated mock type for the Repository type -type Repository struct { - mock.Mock -} - -// BlobObject provides a mock function with given fields: _a0 -func (_m *Repository) BlobObject(_a0 plumbing.Hash) (*object.Blob, error) { - ret := _m.Called(_a0) - - var r0 *object.Blob - if rf, ok := ret.Get(0).(func(plumbing.Hash) *object.Blob); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.Blob) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.Hash) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// BlobObjects provides a mock function with given fields: -func (_m *Repository) BlobObjects() (*object.BlobIter, error) { - ret := _m.Called() - - var r0 *object.BlobIter - if rf, ok := ret.Get(0).(func() *object.BlobIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.BlobIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Branch provides a mock function with given fields: _a0 -func (_m *Repository) Branch(_a0 string) (*config.Branch, error) { - ret := _m.Called(_a0) - - var r0 *config.Branch - if rf, ok := ret.Get(0).(func(string) *config.Branch); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*config.Branch) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Branches provides a mock function with given fields: -func (_m *Repository) Branches() (storer.ReferenceIter, error) { - ret := _m.Called() - - var r0 storer.ReferenceIter - if rf, ok := ret.Get(0).(func() storer.ReferenceIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(storer.ReferenceIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CommitObject provides a mock function with given fields: _a0 -func (_m *Repository) CommitObject(_a0 plumbing.Hash) (*object.Commit, error) { - ret := _m.Called(_a0) - - var r0 *object.Commit - if rf, ok := ret.Get(0).(func(plumbing.Hash) *object.Commit); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.Commit) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.Hash) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CommitObjects provides a mock function with given fields: -func (_m *Repository) CommitObjects() (object.CommitIter, error) { - ret := _m.Called() - - var r0 object.CommitIter - if rf, ok := ret.Get(0).(func() object.CommitIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(object.CommitIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Config provides a mock function with given fields: -func (_m *Repository) Config() (*config.Config, error) { - ret := _m.Called() - - var r0 *config.Config - if rf, ok := ret.Get(0).(func() *config.Config); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*config.Config) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConfigScoped provides a mock function with given fields: _a0 -func (_m *Repository) ConfigScoped(_a0 config.Scope) (*config.Config, error) { - ret := _m.Called(_a0) - - var r0 *config.Config - if rf, ok := ret.Get(0).(func(config.Scope) *config.Config); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*config.Config) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(config.Scope) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateBranch provides a mock function with given fields: _a0 -func (_m *Repository) CreateBranch(_a0 *config.Branch) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*config.Branch) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// CreateRemote provides a mock function with given fields: _a0 -func (_m *Repository) CreateRemote(_a0 *config.RemoteConfig) (*git.Remote, error) { - ret := _m.Called(_a0) - - var r0 *git.Remote - if rf, ok := ret.Get(0).(func(*config.RemoteConfig) *git.Remote); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.Remote) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*config.RemoteConfig) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// CreateRemoteAnonymous provides a mock function with given fields: _a0 -func (_m *Repository) CreateRemoteAnonymous(_a0 *config.RemoteConfig) (*git.Remote, error) { - ret := _m.Called(_a0) - - var r0 *git.Remote - if rf, ok := ret.Get(0).(func(*config.RemoteConfig) *git.Remote); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.Remote) - } - } +// RepackObjects mocks base method. +func (m *MockRepository) RepackObjects(arg0 *git.RepackConfig) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RepackObjects", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - var r1 error - if rf, ok := ret.Get(1).(func(*config.RemoteConfig) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } +// RepackObjects indicates an expected call of RepackObjects. +func (mr *MockRepositoryMockRecorder) RepackObjects(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RepackObjects", reflect.TypeOf((*MockRepository)(nil).RepackObjects), arg0) +} - return r0, r1 -} - -// CreateTag provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Repository) CreateTag(_a0 string, _a1 plumbing.Hash, _a2 *git.CreateTagOptions) (*plumbing.Reference, error) { - ret := _m.Called(_a0, _a1, _a2) +// ResolveRevision mocks base method. +func (m *MockRepository) ResolveRevision(arg0 plumbing.Revision) (*plumbing.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResolveRevision", arg0) + ret0, _ := ret[0].(*plumbing.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 *plumbing.Reference - if rf, ok := ret.Get(0).(func(string, plumbing.Hash, *git.CreateTagOptions) *plumbing.Reference); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*plumbing.Reference) - } - } +// ResolveRevision indicates an expected call of ResolveRevision. +func (mr *MockRepositoryMockRecorder) ResolveRevision(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveRevision", reflect.TypeOf((*MockRepository)(nil).ResolveRevision), arg0) +} - var r1 error - if rf, ok := ret.Get(1).(func(string, plumbing.Hash, *git.CreateTagOptions) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } +// SetConfig mocks base method. +func (m *MockRepository) SetConfig(arg0 *config.Config) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetConfig", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - return r0, r1 -} - -// DeleteBranch provides a mock function with given fields: _a0 -func (_m *Repository) DeleteBranch(_a0 string) error { - ret := _m.Called(_a0) +// SetConfig indicates an expected call of SetConfig. +func (mr *MockRepositoryMockRecorder) SetConfig(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetConfig", reflect.TypeOf((*MockRepository)(nil).SetConfig), arg0) +} - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// Tag mocks base method. +func (m *MockRepository) Tag(arg0 string) (*plumbing.Reference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Tag", arg0) + ret0, _ := ret[0].(*plumbing.Reference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 +// Tag indicates an expected call of Tag. +func (mr *MockRepositoryMockRecorder) Tag(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tag", reflect.TypeOf((*MockRepository)(nil).Tag), arg0) } -// DeleteObject provides a mock function with given fields: _a0 -func (_m *Repository) DeleteObject(_a0 plumbing.Hash) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(plumbing.Hash) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 +// TagObject mocks base method. +func (m *MockRepository) TagObject(arg0 plumbing.Hash) (*object.Tag, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagObject", arg0) + ret0, _ := ret[0].(*object.Tag) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// DeleteRemote provides a mock function with given fields: _a0 -func (_m *Repository) DeleteRemote(_a0 string) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DeleteTag provides a mock function with given fields: _a0 -func (_m *Repository) DeleteTag(_a0 string) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// TagObject indicates an expected call of TagObject. +func (mr *MockRepositoryMockRecorder) TagObject(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagObject", reflect.TypeOf((*MockRepository)(nil).TagObject), arg0) +} - return r0 -} - -// Fetch provides a mock function with given fields: _a0 -func (_m *Repository) Fetch(_a0 *git.FetchOptions) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*git.FetchOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// TagObjects mocks base method. +func (m *MockRepository) TagObjects() (*object.TagIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagObjects") + ret0, _ := ret[0].(*object.TagIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 -} - -// FetchContext provides a mock function with given fields: _a0, _a1 -func (_m *Repository) FetchContext(_a0 context.Context, _a1 *git.FetchOptions) error { - ret := _m.Called(_a0, _a1) +// TagObjects indicates an expected call of TagObjects. +func (mr *MockRepositoryMockRecorder) TagObjects() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagObjects", reflect.TypeOf((*MockRepository)(nil).TagObjects)) +} - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *git.FetchOptions) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } +// Tags mocks base method. +func (m *MockRepository) Tags() (storer.ReferenceIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Tags") + ret0, _ := ret[0].(storer.ReferenceIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 -} - -// Head provides a mock function with given fields: -func (_m *Repository) Head() (*plumbing.Reference, error) { - ret := _m.Called() - - var r0 *plumbing.Reference - if rf, ok := ret.Get(0).(func() *plumbing.Reference); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*plumbing.Reference) - } - } +// Tags indicates an expected call of Tags. +func (mr *MockRepositoryMockRecorder) Tags() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tags", reflect.TypeOf((*MockRepository)(nil).Tags)) +} - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } +// TreeObject mocks base method. +func (m *MockRepository) TreeObject(arg0 plumbing.Hash) (*object.Tree, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TreeObject", arg0) + ret0, _ := ret[0].(*object.Tree) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 -} - -// Log provides a mock function with given fields: _a0 -func (_m *Repository) Log(_a0 *git.LogOptions) (object.CommitIter, error) { - ret := _m.Called(_a0) +// TreeObject indicates an expected call of TreeObject. +func (mr *MockRepositoryMockRecorder) TreeObject(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TreeObject", reflect.TypeOf((*MockRepository)(nil).TreeObject), arg0) +} - var r0 object.CommitIter - if rf, ok := ret.Get(0).(func(*git.LogOptions) object.CommitIter); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(object.CommitIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*git.LogOptions) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } +// TreeObjects mocks base method. +func (m *MockRepository) TreeObjects() (*object.TreeIter, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TreeObjects") + ret0, _ := ret[0].(*object.TreeIter) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TreeObjects indicates an expected call of TreeObjects. +func (mr *MockRepositoryMockRecorder) TreeObjects() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TreeObjects", reflect.TypeOf((*MockRepository)(nil).TreeObjects)) +} + +// Worktree mocks base method. +func (m *MockRepository) Worktree() (*git.Worktree, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Worktree") + ret0, _ := ret[0].(*git.Worktree) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 -} - -// Notes provides a mock function with given fields: -func (_m *Repository) Notes() (storer.ReferenceIter, error) { - ret := _m.Called() - - var r0 storer.ReferenceIter - if rf, ok := ret.Get(0).(func() storer.ReferenceIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(storer.ReferenceIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Object provides a mock function with given fields: _a0, _a1 -func (_m *Repository) Object(_a0 plumbing.ObjectType, _a1 plumbing.Hash) (object.Object, error) { - ret := _m.Called(_a0, _a1) - - var r0 object.Object - if rf, ok := ret.Get(0).(func(plumbing.ObjectType, plumbing.Hash) object.Object); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(object.Object) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.ObjectType, plumbing.Hash) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Objects provides a mock function with given fields: -func (_m *Repository) Objects() (*object.ObjectIter, error) { - ret := _m.Called() - - var r0 *object.ObjectIter - if rf, ok := ret.Get(0).(func() *object.ObjectIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.ObjectIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Prune provides a mock function with given fields: _a0 -func (_m *Repository) Prune(_a0 git.PruneOptions) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(git.PruneOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Push provides a mock function with given fields: _a0 -func (_m *Repository) Push(_a0 *git.PushOptions) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*git.PushOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// PushContext provides a mock function with given fields: _a0, _a1 -func (_m *Repository) PushContext(_a0 context.Context, _a1 *git.PushOptions) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *git.PushOptions) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Reference provides a mock function with given fields: _a0, _a1 -func (_m *Repository) Reference(_a0 plumbing.ReferenceName, _a1 bool) (*plumbing.Reference, error) { - ret := _m.Called(_a0, _a1) - - var r0 *plumbing.Reference - if rf, ok := ret.Get(0).(func(plumbing.ReferenceName, bool) *plumbing.Reference); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*plumbing.Reference) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.ReferenceName, bool) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// References provides a mock function with given fields: -func (_m *Repository) References() (storer.ReferenceIter, error) { - ret := _m.Called() - - var r0 storer.ReferenceIter - if rf, ok := ret.Get(0).(func() storer.ReferenceIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(storer.ReferenceIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Remote provides a mock function with given fields: _a0 -func (_m *Repository) Remote(_a0 string) (*git.Remote, error) { - ret := _m.Called(_a0) - - var r0 *git.Remote - if rf, ok := ret.Get(0).(func(string) *git.Remote); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.Remote) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Remotes provides a mock function with given fields: -func (_m *Repository) Remotes() ([]*git.Remote, error) { - ret := _m.Called() - - var r0 []*git.Remote - if rf, ok := ret.Get(0).(func() []*git.Remote); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*git.Remote) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RepackObjects provides a mock function with given fields: _a0 -func (_m *Repository) RepackObjects(_a0 *git.RepackConfig) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*git.RepackConfig) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ResolveRevision provides a mock function with given fields: _a0 -func (_m *Repository) ResolveRevision(_a0 plumbing.Revision) (*plumbing.Hash, error) { - ret := _m.Called(_a0) - - var r0 *plumbing.Hash - if rf, ok := ret.Get(0).(func(plumbing.Revision) *plumbing.Hash); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*plumbing.Hash) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.Revision) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetConfig provides a mock function with given fields: _a0 -func (_m *Repository) SetConfig(_a0 *config.Config) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*config.Config) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Tag provides a mock function with given fields: _a0 -func (_m *Repository) Tag(_a0 string) (*plumbing.Reference, error) { - ret := _m.Called(_a0) - - var r0 *plumbing.Reference - if rf, ok := ret.Get(0).(func(string) *plumbing.Reference); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*plumbing.Reference) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TagObject provides a mock function with given fields: _a0 -func (_m *Repository) TagObject(_a0 plumbing.Hash) (*object.Tag, error) { - ret := _m.Called(_a0) - - var r0 *object.Tag - if rf, ok := ret.Get(0).(func(plumbing.Hash) *object.Tag); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.Tag) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.Hash) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TagObjects provides a mock function with given fields: -func (_m *Repository) TagObjects() (*object.TagIter, error) { - ret := _m.Called() - - var r0 *object.TagIter - if rf, ok := ret.Get(0).(func() *object.TagIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.TagIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Tags provides a mock function with given fields: -func (_m *Repository) Tags() (storer.ReferenceIter, error) { - ret := _m.Called() - - var r0 storer.ReferenceIter - if rf, ok := ret.Get(0).(func() storer.ReferenceIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(storer.ReferenceIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TreeObject provides a mock function with given fields: _a0 -func (_m *Repository) TreeObject(_a0 plumbing.Hash) (*object.Tree, error) { - ret := _m.Called(_a0) - - var r0 *object.Tree - if rf, ok := ret.Get(0).(func(plumbing.Hash) *object.Tree); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.Tree) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(plumbing.Hash) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TreeObjects provides a mock function with given fields: -func (_m *Repository) TreeObjects() (*object.TreeIter, error) { - ret := _m.Called() - - var r0 *object.TreeIter - if rf, ok := ret.Get(0).(func() *object.TreeIter); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*object.TreeIter) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Worktree provides a mock function with given fields: -func (_m *Repository) Worktree() (*git.Worktree, error) { - ret := _m.Called() - - var r0 *git.Worktree - if rf, ok := ret.Get(0).(func() *git.Worktree); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.Worktree) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Worktree indicates an expected call of Worktree. +func (mr *MockRepositoryMockRecorder) Worktree() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Worktree", reflect.TypeOf((*MockRepository)(nil).Worktree)) } diff --git a/pkg/git/gogit/mocks/worktree.go b/pkg/git/gogit/mocks/worktree.go index 287dfd07..70d5f40a 100644 --- a/pkg/git/gogit/mocks/worktree.go +++ b/pkg/git/gogit/mocks/worktree.go @@ -1,314 +1,269 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./gogit/worktree.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" git "github.com/go-git/go-git/v5" - - mock "github.com/stretchr/testify/mock" - plumbing "github.com/go-git/go-git/v5/plumbing" + gomock "github.com/golang/mock/gomock" ) -// Worktree is an autogenerated mock type for the Worktree type -type Worktree struct { - mock.Mock +// MockWorktree is a mock of Worktree interface. +type MockWorktree struct { + ctrl *gomock.Controller + recorder *MockWorktreeMockRecorder } -// Add provides a mock function with given fields: _a0 -func (_m *Worktree) Add(_a0 string) (plumbing.Hash, error) { - ret := _m.Called(_a0) +// MockWorktreeMockRecorder is the mock recorder for MockWorktree. +type MockWorktreeMockRecorder struct { + mock *MockWorktree +} + +// NewMockWorktree creates a new mock instance. +func NewMockWorktree(ctrl *gomock.Controller) *MockWorktree { + mock := &MockWorktree{ctrl: ctrl} + mock.recorder = &MockWorktreeMockRecorder{mock} + return mock +} - var r0 plumbing.Hash - if rf, ok := ret.Get(0).(func(string) plumbing.Hash); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(plumbing.Hash) - } - } +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockWorktree) EXPECT() *MockWorktreeMockRecorder { + return m.recorder +} - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } +// Add mocks base method. +func (m *MockWorktree) Add(arg0 string) (plumbing.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Add", arg0) + ret0, _ := ret[0].(plumbing.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 +// Add indicates an expected call of Add. +func (mr *MockWorktreeMockRecorder) Add(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*MockWorktree)(nil).Add), arg0) } -// AddGlob provides a mock function with given fields: _a0 -func (_m *Worktree) AddGlob(_a0 string) error { - ret := _m.Called(_a0) +// AddGlob mocks base method. +func (m *MockWorktree) AddGlob(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddGlob", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// AddGlob indicates an expected call of AddGlob. +func (mr *MockWorktreeMockRecorder) AddGlob(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddGlob", reflect.TypeOf((*MockWorktree)(nil).AddGlob), arg0) +} - return r0 +// AddWithOptions mocks base method. +func (m *MockWorktree) AddWithOptions(arg0 *git.AddOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddWithOptions", arg0) + ret0, _ := ret[0].(error) + return ret0 } -// AddWithOptions provides a mock function with given fields: _a0 -func (_m *Worktree) AddWithOptions(_a0 *git.AddOptions) error { - ret := _m.Called(_a0) +// AddWithOptions indicates an expected call of AddWithOptions. +func (mr *MockWorktreeMockRecorder) AddWithOptions(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddWithOptions", reflect.TypeOf((*MockWorktree)(nil).AddWithOptions), arg0) +} - var r0 error - if rf, ok := ret.Get(0).(func(*git.AddOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// Checkout mocks base method. +func (m *MockWorktree) Checkout(arg0 *git.CheckoutOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Checkout", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - return r0 +// Checkout indicates an expected call of Checkout. +func (mr *MockWorktreeMockRecorder) Checkout(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Checkout", reflect.TypeOf((*MockWorktree)(nil).Checkout), arg0) } -// Checkout provides a mock function with given fields: _a0 -func (_m *Worktree) Checkout(_a0 *git.CheckoutOptions) error { - ret := _m.Called(_a0) +// Clean mocks base method. +func (m *MockWorktree) Clean(arg0 *git.CleanOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Clean", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - var r0 error - if rf, ok := ret.Get(0).(func(*git.CheckoutOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// Clean indicates an expected call of Clean. +func (mr *MockWorktreeMockRecorder) Clean(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Clean", reflect.TypeOf((*MockWorktree)(nil).Clean), arg0) +} - return r0 +// Commit mocks base method. +func (m *MockWorktree) Commit(arg0 string, arg1 *git.CommitOptions) (plumbing.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Commit", arg0, arg1) + ret0, _ := ret[0].(plumbing.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Clean provides a mock function with given fields: _a0 -func (_m *Worktree) Clean(_a0 *git.CleanOptions) error { - ret := _m.Called(_a0) +// Commit indicates an expected call of Commit. +func (mr *MockWorktreeMockRecorder) Commit(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Commit", reflect.TypeOf((*MockWorktree)(nil).Commit), arg0, arg1) +} - var r0 error - if rf, ok := ret.Get(0).(func(*git.CleanOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } +// Grep mocks base method. +func (m *MockWorktree) Grep(arg0 *git.GrepOptions) ([]git.GrepResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Grep", arg0) + ret0, _ := ret[0].([]git.GrepResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 +// Grep indicates an expected call of Grep. +func (mr *MockWorktreeMockRecorder) Grep(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Grep", reflect.TypeOf((*MockWorktree)(nil).Grep), arg0) } -// Commit provides a mock function with given fields: _a0, _a1 -func (_m *Worktree) Commit(_a0 string, _a1 *git.CommitOptions) (plumbing.Hash, error) { - ret := _m.Called(_a0, _a1) +// Move mocks base method. +func (m *MockWorktree) Move(arg0, arg1 string) (plumbing.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Move", arg0, arg1) + ret0, _ := ret[0].(plumbing.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 plumbing.Hash - if rf, ok := ret.Get(0).(func(string, *git.CommitOptions) plumbing.Hash); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(plumbing.Hash) - } - } +// Move indicates an expected call of Move. +func (mr *MockWorktreeMockRecorder) Move(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Move", reflect.TypeOf((*MockWorktree)(nil).Move), arg0, arg1) +} - var r1 error - if rf, ok := ret.Get(1).(func(string, *git.CommitOptions) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } +// Pull mocks base method. +func (m *MockWorktree) Pull(arg0 *git.PullOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Pull", arg0) + ret0, _ := ret[0].(error) + return ret0 +} - return r0, r1 -} - -// Grep provides a mock function with given fields: _a0 -func (_m *Worktree) Grep(_a0 *git.GrepOptions) ([]git.GrepResult, error) { - ret := _m.Called(_a0) - - var r0 []git.GrepResult - if rf, ok := ret.Get(0).(func(*git.GrepOptions) []git.GrepResult); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]git.GrepResult) - } - } +// Pull indicates an expected call of Pull. +func (mr *MockWorktreeMockRecorder) Pull(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pull", reflect.TypeOf((*MockWorktree)(nil).Pull), arg0) +} - var r1 error - if rf, ok := ret.Get(1).(func(*git.GrepOptions) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } +// PullContext mocks base method. +func (m *MockWorktree) PullContext(arg0 context.Context, arg1 *git.PullOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PullContext", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} - return r0, r1 +// PullContext indicates an expected call of PullContext. +func (mr *MockWorktreeMockRecorder) PullContext(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PullContext", reflect.TypeOf((*MockWorktree)(nil).PullContext), arg0, arg1) } -// Move provides a mock function with given fields: _a0, _a1 -func (_m *Worktree) Move(_a0 string, _a1 string) (plumbing.Hash, error) { - ret := _m.Called(_a0, _a1) +// Remove mocks base method. +func (m *MockWorktree) Remove(arg0 string) (plumbing.Hash, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Remove", arg0) + ret0, _ := ret[0].(plumbing.Hash) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Remove indicates an expected call of Remove. +func (mr *MockWorktreeMockRecorder) Remove(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockWorktree)(nil).Remove), arg0) +} + +// RemoveGlob mocks base method. +func (m *MockWorktree) RemoveGlob(arg0 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveGlob", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RemoveGlob indicates an expected call of RemoveGlob. +func (mr *MockWorktreeMockRecorder) RemoveGlob(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveGlob", reflect.TypeOf((*MockWorktree)(nil).RemoveGlob), arg0) +} + +// Reset mocks base method. +func (m *MockWorktree) Reset(arg0 *git.ResetOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Reset", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Reset indicates an expected call of Reset. +func (mr *MockWorktreeMockRecorder) Reset(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockWorktree)(nil).Reset), arg0) +} + +// Status mocks base method. +func (m *MockWorktree) Status() (git.Status, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Status") + ret0, _ := ret[0].(git.Status) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Status indicates an expected call of Status. +func (mr *MockWorktreeMockRecorder) Status() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockWorktree)(nil).Status)) +} + +// Submodule mocks base method. +func (m *MockWorktree) Submodule(arg0 string) (*git.Submodule, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Submodule", arg0) + ret0, _ := ret[0].(*git.Submodule) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Submodule indicates an expected call of Submodule. +func (mr *MockWorktreeMockRecorder) Submodule(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Submodule", reflect.TypeOf((*MockWorktree)(nil).Submodule), arg0) +} - var r0 plumbing.Hash - if rf, ok := ret.Get(0).(func(string, string) plumbing.Hash); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(plumbing.Hash) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Submodules mocks base method. +func (m *MockWorktree) Submodules() (git.Submodules, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Submodules") + ret0, _ := ret[0].(git.Submodules) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Pull provides a mock function with given fields: _a0 -func (_m *Worktree) Pull(_a0 *git.PullOptions) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*git.PullOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// PullContext provides a mock function with given fields: _a0, _a1 -func (_m *Worktree) PullContext(_a0 context.Context, _a1 *git.PullOptions) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *git.PullOptions) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Remove provides a mock function with given fields: _a0 -func (_m *Worktree) Remove(_a0 string) (plumbing.Hash, error) { - ret := _m.Called(_a0) - - var r0 plumbing.Hash - if rf, ok := ret.Get(0).(func(string) plumbing.Hash); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(plumbing.Hash) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveGlob provides a mock function with given fields: _a0 -func (_m *Worktree) RemoveGlob(_a0 string) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Reset provides a mock function with given fields: _a0 -func (_m *Worktree) Reset(_a0 *git.ResetOptions) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(*git.ResetOptions) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Status provides a mock function with given fields: -func (_m *Worktree) Status() (git.Status, error) { - ret := _m.Called() - - var r0 git.Status - if rf, ok := ret.Get(0).(func() git.Status); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(git.Status) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Submodule provides a mock function with given fields: _a0 -func (_m *Worktree) Submodule(_a0 string) (*git.Submodule, error) { - ret := _m.Called(_a0) - - var r0 *git.Submodule - if rf, ok := ret.Get(0).(func(string) *git.Submodule); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*git.Submodule) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Submodules provides a mock function with given fields: -func (_m *Worktree) Submodules() (git.Submodules, error) { - ret := _m.Called() - - var r0 git.Submodules - if rf, ok := ret.Get(0).(func() git.Submodules); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(git.Submodules) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// Submodules indicates an expected call of Submodules. +func (mr *MockWorktreeMockRecorder) Submodules() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Submodules", reflect.TypeOf((*MockWorktree)(nil).Submodules)) } diff --git a/pkg/git/mocks/provider.go b/pkg/git/mocks/provider.go index c7709e5b..365d8523 100644 --- a/pkg/git/mocks/provider.go +++ b/pkg/git/mocks/provider.go @@ -1,36 +1,51 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./provider.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" git "github.com/argoproj-labs/argocd-autopilot/pkg/git" - mock "github.com/stretchr/testify/mock" + gomock "github.com/golang/mock/gomock" ) -// Provider is an autogenerated mock type for the Provider type -type Provider struct { - mock.Mock +// MockProvider is a mock of Provider interface. +type MockProvider struct { + ctrl *gomock.Controller + recorder *MockProviderMockRecorder } -// CreateRepository provides a mock function with given fields: ctx, opts -func (_m *Provider) CreateRepository(ctx context.Context, opts *git.CreateRepoOptions) (string, error) { - ret := _m.Called(ctx, opts) - - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, *git.CreateRepoOptions) string); ok { - r0 = rf(ctx, opts) - } else { - r0 = ret.Get(0).(string) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *git.CreateRepoOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } - - return r0, r1 +// MockProviderMockRecorder is the mock recorder for MockProvider. +type MockProviderMockRecorder struct { + mock *MockProvider +} + +// NewMockProvider creates a new mock instance. +func NewMockProvider(ctrl *gomock.Controller) *MockProvider { + mock := &MockProvider{ctrl: ctrl} + mock.recorder = &MockProviderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProvider) EXPECT() *MockProviderMockRecorder { + return m.recorder +} + +// CreateRepository mocks base method. +func (m *MockProvider) CreateRepository(ctx context.Context, opts *git.CreateRepoOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRepository", ctx, opts) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRepository indicates an expected call of CreateRepository. +func (mr *MockProviderMockRecorder) CreateRepository(ctx, opts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRepository", reflect.TypeOf((*MockProvider)(nil).CreateRepository), ctx, opts) } diff --git a/pkg/git/mocks/repository.go b/pkg/git/mocks/repository.go index 76eba45b..fd7ac2e7 100644 --- a/pkg/git/mocks/repository.go +++ b/pkg/git/mocks/repository.go @@ -1,57 +1,66 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./repository.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" git "github.com/argoproj-labs/argocd-autopilot/pkg/git" - mock "github.com/stretchr/testify/mock" + gomock "github.com/golang/mock/gomock" ) -// Repository is an autogenerated mock type for the Repository type -type Repository struct { - mock.Mock +// MockRepository is a mock of Repository interface. +type MockRepository struct { + ctrl *gomock.Controller + recorder *MockRepositoryMockRecorder } -// CurrentBranch provides a mock function with given fields: -func (_m *Repository) CurrentBranch() (string, error) { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } +// MockRepositoryMockRecorder is the mock recorder for MockRepository. +type MockRepositoryMockRecorder struct { + mock *MockRepository +} - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } +// NewMockRepository creates a new mock instance. +func NewMockRepository(ctrl *gomock.Controller) *MockRepository { + mock := &MockRepository{ctrl: ctrl} + mock.recorder = &MockRepositoryMockRecorder{mock} + return mock +} - return r0, r1 +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { + return m.recorder } -// Persist provides a mock function with given fields: ctx, opts -func (_m *Repository) Persist(ctx context.Context, opts *git.PushOptions) (string, error) { - ret := _m.Called(ctx, opts) +// CurrentBranch mocks base method. +func (m *MockRepository) CurrentBranch() (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrentBranch") + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, *git.PushOptions) string); ok { - r0 = rf(ctx, opts) - } else { - r0 = ret.Get(0).(string) - } +// CurrentBranch indicates an expected call of CurrentBranch. +func (mr *MockRepositoryMockRecorder) CurrentBranch() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentBranch", reflect.TypeOf((*MockRepository)(nil).CurrentBranch)) +} - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *git.PushOptions) error); ok { - r1 = rf(ctx, opts) - } else { - r1 = ret.Error(1) - } +// Persist mocks base method. +func (m *MockRepository) Persist(ctx context.Context, opts *git.PushOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Persist", ctx, opts) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 +// Persist indicates an expected call of Persist. +func (mr *MockRepositoryMockRecorder) Persist(ctx, opts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Persist", reflect.TypeOf((*MockRepository)(nil).Persist), ctx, opts) } diff --git a/pkg/git/provider.go b/pkg/git/provider.go index 6db61497..8e310e04 100644 --- a/pkg/git/provider.go +++ b/pkg/git/provider.go @@ -6,7 +6,7 @@ import ( "sort" ) -//go:generate mockery --name Provider --filename provider.go +//go:generate mockgen -destination=./mocks/provider.go -package=mocks -source=./provider.go Provider type ( // Provider represents a git provider diff --git a/pkg/git/provider_ado.go b/pkg/git/provider_ado.go index 074f06cd..ffeae352 100644 --- a/pkg/git/provider_ado.go +++ b/pkg/git/provider_ado.go @@ -3,14 +3,16 @@ package git import ( "context" "fmt" - "github.com/microsoft/azure-devops-go-api/azuredevops" - ado "github.com/microsoft/azure-devops-go-api/azuredevops/git" "net/url" "strings" "time" + + "github.com/microsoft/azure-devops-go-api/azuredevops" + ado "github.com/microsoft/azure-devops-go-api/azuredevops/git" ) -//go:generate mockery --name Ado* --output ado/mocks --case snake +//go:generate mockgen -destination=./ado/mocks/ado.go -package=mocks -source=./provider_ado.go AdoClient,AdoUrl + type ( AdoClient interface { CreateRepository(context.Context, ado.CreateRepositoryArgs) (*ado.GitRepository, error) diff --git a/pkg/git/provider_ado_test.go b/pkg/git/provider_ado_test.go index 93828cc2..a11c3fa3 100644 --- a/pkg/git/provider_ado_test.go +++ b/pkg/git/provider_ado_test.go @@ -4,23 +4,24 @@ import ( "context" "errors" "fmt" + "testing" + adoMock "github.com/argoproj-labs/argocd-autopilot/pkg/git/ado/mocks" + "github.com/golang/mock/gomock" ado "github.com/microsoft/azure-devops-go-api/azuredevops/git" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "testing" ) func Test_adoGit_CreateRepository(t *testing.T) { remoteURL := "https://dev.azure.com/SUB/PROJECT/_git/REPO" - emptyFunc := func(client *adoMock.AdoClient, url *adoMock.AdoUrl) {} + emptyFunc := func(client *adoMock.MockAdoClient, url *adoMock.MockAdoUrl) {} type args struct { ctx context.Context opts *CreateRepoOptions } tests := []struct { name string - mockClient func(client *adoMock.AdoClient, url *adoMock.AdoUrl) + mockClient func(client *adoMock.MockAdoClient, url *adoMock.MockAdoUrl) args args want string wantErr assert.ErrorAssertionFunc @@ -34,11 +35,13 @@ func Test_adoGit_CreateRepository(t *testing.T) { }, want: "", wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return true }}, - {name: "Failure creating repo", mockClient: func(client *adoMock.AdoClient, url *adoMock.AdoUrl) { - client.On("CreateRepository", context.TODO(), - mock.AnythingOfType("CreateRepositoryArgs")). + {name: "Failure creating repo", mockClient: func(client *adoMock.MockAdoClient, url *adoMock.MockAdoUrl) { + client.EXPECT().CreateRepository(context.TODO(), gomock.AssignableToTypeOf(ado.CreateRepositoryArgs{})). + Times(1). Return(nil, errors.New("ah an error")) - url.On("GetProjectName").Return("blah") + url.EXPECT().GetProjectName(). + Times(1). + Return("blah") }, args: args{ ctx: context.TODO(), opts: &CreateRepoOptions{ @@ -48,23 +51,27 @@ func Test_adoGit_CreateRepository(t *testing.T) { }, want: "", wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return true }}, - {name: "Success creating repo", mockClient: func(client *adoMock.AdoClient, url *adoMock.AdoUrl) { - url.On("GetProjectName").Return("PROJECT") - client.On("CreateRepository", context.TODO(), mock.AnythingOfType("CreateRepositoryArgs")).Return(&ado.GitRepository{ - Links: nil, - DefaultBranch: nil, - Id: nil, - IsFork: nil, - Name: nil, - ParentRepository: nil, - Project: nil, - RemoteUrl: &remoteURL, - Size: nil, - SshUrl: nil, - Url: nil, - ValidRemoteUrls: nil, - WebUrl: nil, - }, nil) + {name: "Success creating repo", mockClient: func(client *adoMock.MockAdoClient, url *adoMock.MockAdoUrl) { + url.EXPECT().GetProjectName(). + Times(1). + Return("PROJECT") + client.EXPECT().CreateRepository(context.TODO(), gomock.AssignableToTypeOf(ado.CreateRepositoryArgs{})). + Times(1). + Return(&ado.GitRepository{ + Links: nil, + DefaultBranch: nil, + Id: nil, + IsFork: nil, + Name: nil, + ParentRepository: nil, + Project: nil, + RemoteUrl: &remoteURL, + Size: nil, + SshUrl: nil, + Url: nil, + ValidRemoteUrls: nil, + WebUrl: nil, + }, nil) }, args: args{ ctx: context.TODO(), opts: &CreateRepoOptions{ @@ -77,8 +84,9 @@ func Test_adoGit_CreateRepository(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - mockClient := &adoMock.AdoClient{} - mockUrl := &adoMock.AdoUrl{} + ctrl := gomock.NewController(t) + mockClient := adoMock.NewMockAdoClient(ctrl) + mockUrl := adoMock.NewMockAdoUrl(ctrl) tt.mockClient(mockClient, mockUrl) g := &adoGit{ adoClient: mockClient, diff --git a/pkg/git/provider_gitea.go b/pkg/git/provider_gitea.go index b87e33f9..721e6e9d 100644 --- a/pkg/git/provider_gitea.go +++ b/pkg/git/provider_gitea.go @@ -7,7 +7,7 @@ import ( gt "code.gitea.io/sdk/gitea" ) -//go:generate mockery --name Client --output gitea/mocks --case snake +//go:generate mockgen -destination=./gitea/mocks/client.go -package=mocks -source=./provider_gitea.go Client type ( Client interface { diff --git a/pkg/git/provider_gitea_test.go b/pkg/git/provider_gitea_test.go index 626b97e9..37ee9c9a 100644 --- a/pkg/git/provider_gitea_test.go +++ b/pkg/git/provider_gitea_test.go @@ -7,6 +7,7 @@ import ( "testing" gtmocks "github.com/argoproj-labs/argocd-autopilot/pkg/git/gitea/mocks" + "github.com/golang/mock/gomock" gt "code.gitea.io/sdk/gitea" "github.com/stretchr/testify/assert" @@ -15,7 +16,7 @@ import ( func Test_gitea_CreateRepository(t *testing.T) { tests := map[string]struct { opts *CreateRepoOptions - beforeFn func(*gtmocks.Client) + beforeFn func(*gtmocks.MockClient) want string wantErr string }{ @@ -24,13 +25,15 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "username", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { res := >.Response{ Response: &http.Response{ StatusCode: 401, }, } - c.On("GetMyUserInfo").Return(nil, res, errors.New("some error")) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "authentication failed, make sure credentials are correct: some error", }, @@ -39,11 +42,13 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "username", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { res := >.Response{ Response: &http.Response{}, } - c.On("GetMyUserInfo").Return(nil, res, errors.New("some error")) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "some error", }, @@ -52,9 +57,11 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "org", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { u := >.User{UserName: "username"} - c.On("GetMyUserInfo").Return(u, nil, nil) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(u, nil, nil) createOpts := gt.CreateRepoOption{ Name: "repo", Private: false, @@ -64,7 +71,9 @@ func Test_gitea_CreateRepository(t *testing.T) { StatusCode: 404, }, } - c.On("CreateOrgRepo", "org", createOpts).Return(nil, res, errors.New("some error")) + c.EXPECT().CreateOrgRepo("org", createOpts). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "owner org not found: some error", }, @@ -73,9 +82,11 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "username", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { u := >.User{UserName: "username"} - c.On("GetMyUserInfo").Return(u, nil, nil) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(u, nil, nil) createOpts := gt.CreateRepoOption{ Name: "repo", Private: false, @@ -83,7 +94,9 @@ func Test_gitea_CreateRepository(t *testing.T) { res := >.Response{ Response: &http.Response{}, } - c.On("CreateRepo", createOpts).Return(nil, res, errors.New("some error")) + c.EXPECT().CreateRepo(createOpts). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "some error", }, @@ -92,9 +105,11 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "org", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { u := >.User{UserName: "username"} - c.On("GetMyUserInfo").Return(u, nil, nil) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(u, nil, nil) r := >.Repository{ CloneURL: "http://gitea.com/org/repo", } @@ -102,7 +117,9 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Private: false, } - c.On("CreateOrgRepo", "org", createOpts).Return(r, nil, nil) + c.EXPECT().CreateOrgRepo("org", createOpts). + Times(1). + Return(r, nil, nil) }, want: "http://gitea.com/org/repo", }, @@ -111,9 +128,11 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Owner: "username", }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { u := >.User{UserName: "username"} - c.On("GetMyUserInfo").Return(u, nil, nil) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(u, nil, nil) r := >.Repository{ CloneURL: "http://gitea.com/username/repo", } @@ -121,7 +140,9 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Private: false, } - c.On("CreateRepo", createOpts).Return(r, nil, nil) + c.EXPECT().CreateRepo(createOpts). + Times(1). + Return(r, nil, nil) }, want: "http://gitea.com/username/repo", }, @@ -131,9 +152,11 @@ func Test_gitea_CreateRepository(t *testing.T) { Owner: "username", Private: true, }, - beforeFn: func(c *gtmocks.Client) { + beforeFn: func(c *gtmocks.MockClient) { u := >.User{UserName: "username"} - c.On("GetMyUserInfo").Return(u, nil, nil) + c.EXPECT().GetMyUserInfo(). + Times(1). + Return(u, nil, nil) r := >.Repository{ CloneURL: "http://gitea.com/username/repo", } @@ -141,21 +164,22 @@ func Test_gitea_CreateRepository(t *testing.T) { Name: "repo", Private: true, } - c.On("CreateRepo", createOpts).Return(r, nil, nil) + c.EXPECT().CreateRepo(createOpts). + Times(1). + Return(r, nil, nil) }, want: "http://gitea.com/username/repo", }, } for name, tt := range tests { t.Run(name, func(t *testing.T) { - mockClient := >mocks.Client{} + mockClient := gtmocks.NewMockClient(gomock.NewController(t)) tt.beforeFn(mockClient) g := &gitea{ client: mockClient, } got, err := g.CreateRepository(context.Background(), tt.opts) - mockClient.AssertExpectations(t) if err != nil { if tt.wantErr != "" { assert.EqualError(t, err, tt.wantErr) diff --git a/pkg/git/provider_github.go b/pkg/git/provider_github.go index 736bb34e..5b146fe4 100644 --- a/pkg/git/provider_github.go +++ b/pkg/git/provider_github.go @@ -11,7 +11,9 @@ import ( gh "github.com/google/go-github/v35/github" ) -//go:generate mockery --dir github --all --output github/mocks --case snake +//go:generate mockgen -destination=./github/mocks/repos.go -package=mocks -source=./github/repos.go Repositories +//go:generate mockgen -destination=./github/mocks/users.go -package=mocks -source=./github/users.go Users + type github struct { opts *ProviderOptions Repositories g.Repositories @@ -20,7 +22,7 @@ type github struct { func newGithub(opts *ProviderOptions) (Provider, error) { var ( - c *gh.Client + c *gh.Client err error ) diff --git a/pkg/git/provider_github_test.go b/pkg/git/provider_github_test.go index 6d4762c9..5d56f416 100644 --- a/pkg/git/provider_github_test.go +++ b/pkg/git/provider_github_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/argoproj-labs/argocd-autopilot/pkg/git/github/mocks" + "github.com/golang/mock/gomock" gh "github.com/google/go-github/v35/github" "github.com/stretchr/testify/assert" @@ -14,95 +15,133 @@ import ( func Test_github_CreateRepository(t *testing.T) { tests := map[string]struct { - user *gh.User - userErr error - repo *gh.Repository - repoErr error - opts *CreateRepoOptions - org string - want string - wantErr string + opts *CreateRepoOptions + beforeFn func(*mocks.MockRepositories, *mocks.MockUsers) + want string + wantErr string }{ "Error getting user": { - userErr: errors.New("Some user error"), opts: &CreateRepoOptions{ Owner: "owner", Name: "name", Private: false, }, + beforeFn: func(mr *mocks.MockRepositories, mu *mocks.MockUsers) { + mu.EXPECT().Get(context.Background(), ""). + Times(1). + Return(nil, &gh.Response{Response: &http.Response{ + StatusCode: 200, + }}, errors.New("Some user error")) + }, wantErr: "Some user error", }, "Error creating repo": { - user: &gh.User{ - Login: gh.String("owner"), - }, opts: &CreateRepoOptions{ Owner: "owner", Name: "name", Private: false, }, - repoErr: errors.New("Some repo error"), + beforeFn: func(mr *mocks.MockRepositories, mu *mocks.MockUsers) { + mu.EXPECT().Get(context.Background(), ""). + Times(1). + Return(&gh.User{ + Login: gh.String("owner"), + }, nil, nil) + + mr.EXPECT().Create(context.Background(), "", &gh.Repository{ + Name: gh.String("name"), + Private: gh.Bool(false), + }). + Times(1). + Return(nil, &gh.Response{Response: &http.Response{ + StatusCode: 200, + }}, errors.New("Some repo error")) + }, wantErr: "Some repo error", }, "Creates with empty org": { - user: &gh.User{ - Login: gh.String("owner"), - }, opts: &CreateRepoOptions{ Owner: "owner", Name: "name", Private: false, }, - repo: &gh.Repository{ - CloneURL: gh.String("https://github.com/owner/repo"), + beforeFn: func(mr *mocks.MockRepositories, mu *mocks.MockUsers) { + mu.EXPECT().Get(context.Background(), ""). + Times(1). + Return(&gh.User{ + Login: gh.String("owner"), + }, nil, nil) + + mr.EXPECT().Create(context.Background(), "", &gh.Repository{ + Name: gh.String("name"), + Private: gh.Bool(false), + }). + Times(1). + Return(&gh.Repository{ + CloneURL: gh.String("https://github.com/owner/repo"), + }, &gh.Response{Response: &http.Response{ + StatusCode: 200, + }}, nil) }, want: "https://github.com/owner/repo", }, "Creates with org": { - user: &gh.User{ - Login: gh.String("owner"), - }, opts: &CreateRepoOptions{ Owner: "org", Name: "name", Private: false, }, - org: "org", - repo: &gh.Repository{ - CloneURL: gh.String("https://github.com/org/repo"), + beforeFn: func(mr *mocks.MockRepositories, mu *mocks.MockUsers) { + mu.EXPECT().Get(context.Background(), ""). + Times(1). + Return(&gh.User{ + Login: gh.String("owner"), + }, nil, nil) + + mr.EXPECT().Create(context.Background(), "org", &gh.Repository{ + Name: gh.String("name"), + Private: gh.Bool(false), + }). + Times(1). + Return(&gh.Repository{ + CloneURL: gh.String("https://github.com/org/repo"), + }, &gh.Response{Response: &http.Response{ + StatusCode: 200, + }}, nil) }, want: "https://github.com/org/repo", }, "Error when no cloneURL": { - user: &gh.User{ - Login: gh.String("owner"), - }, opts: &CreateRepoOptions{ Owner: "org", Name: "name", Private: false, }, - org: "org", - repo: &gh.Repository{}, + beforeFn: func(mr *mocks.MockRepositories, mu *mocks.MockUsers) { + mu.EXPECT().Get(context.Background(), ""). + Times(1). + Return(&gh.User{ + Login: gh.String("owner"), + }, nil, nil) + + mr.EXPECT().Create(context.Background(), "org", &gh.Repository{ + Name: gh.String("name"), + Private: gh.Bool(false), + }). + Times(1). + Return(&gh.Repository{}, &gh.Response{Response: &http.Response{StatusCode: 200}}, nil) + }, wantErr: "repo clone url is nil", }, } for name, tt := range tests { t.Run(name, func(t *testing.T) { - mockUsers := new(mocks.Users) - mockRepo := new(mocks.Repositories) + ctrl := gomock.NewController(t) + mockUsers := mocks.NewMockUsers(ctrl) + mockRepo := mocks.NewMockRepositories(ctrl) ctx := context.Background() - mockUsers.On("Get", ctx, "").Return(tt.user, &gh.Response{Response: &http.Response{ - StatusCode: 200, - }}, tt.userErr) - - mockRepo.On("Create", ctx, tt.org, &gh.Repository{ - Name: gh.String(tt.opts.Name), - Private: gh.Bool(tt.opts.Private), - }).Return(tt.repo, &gh.Response{Response: &http.Response{ - StatusCode: 200, - }}, tt.repoErr) + tt.beforeFn(mockRepo, mockUsers) g := &github{ Repositories: mockRepo, diff --git a/pkg/git/provider_gitlab.go b/pkg/git/provider_gitlab.go index 1ce0a68b..520bf0a9 100644 --- a/pkg/git/provider_gitlab.go +++ b/pkg/git/provider_gitlab.go @@ -7,7 +7,7 @@ import ( gl "github.com/xanzy/go-gitlab" ) -//go:generate mockery --name GitlabClient --output gitlab/mocks --case snake +//go:generate mockgen -destination=./gitlab/mocks/client.go -package=mocks -source=./provider_gitlab.go GitlabClient type ( GitlabClient interface { diff --git a/pkg/git/provider_gitlab_test.go b/pkg/git/provider_gitlab_test.go index b9e07ed1..2736e072 100644 --- a/pkg/git/provider_gitlab_test.go +++ b/pkg/git/provider_gitlab_test.go @@ -7,6 +7,7 @@ import ( "testing" glmocks "github.com/argoproj-labs/argocd-autopilot/pkg/git/gitlab/mocks" + "github.com/golang/mock/gomock" gl "github.com/xanzy/go-gitlab" "github.com/stretchr/testify/assert" @@ -15,7 +16,7 @@ import ( func Test_gitlab_CreateRepository(t *testing.T) { tests := map[string]struct { opts *CreateRepoOptions - beforeFn func(*glmocks.GitlabClient) + beforeFn func(*glmocks.MockGitlabClient) want string wantErr string }{ @@ -24,13 +25,15 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "username", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { res := &gl.Response{ Response: &http.Response{ StatusCode: 401, }, } - c.On("CurrentUser").Return(nil, res, errors.New("some error")) + c.EXPECT().CurrentUser(). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "authentication failed, make sure credentials are correct: some error", }, @@ -39,11 +42,13 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "username", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { res := &gl.Response{ Response: &http.Response{}, } - c.On("CurrentUser").Return(nil, res, errors.New("some error")) + c.EXPECT().CurrentUser(). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "some error", }, @@ -52,14 +57,19 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "org", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) g := []*gl.Group{{FullPath: "anotherOrg", ID: 1}} - c.On("ListGroups", &gl.ListGroupsOptions{ + + c.EXPECT().CurrentUser(). + Times(1). + Return(u, nil, nil) + c.EXPECT().ListGroups(&gl.ListGroupsOptions{ MinAccessLevel: gl.AccessLevel(gl.DeveloperPermissions), TopLevelOnly: gl.Bool(false), - }).Return(g, nil, nil) + }). + Times(1). + Return(g, nil, nil) }, wantErr: "group org not found", }, @@ -68,9 +78,8 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "username", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), Visibility: gl.Visibility(gl.PublicVisibility), @@ -78,7 +87,14 @@ func Test_gitlab_CreateRepository(t *testing.T) { res := &gl.Response{ Response: &http.Response{}, } - c.On("CreateProject", &createOpts).Return(nil, res, errors.New("some error")) + + c.EXPECT().CurrentUser(). + Times(1). + Return(u, nil, nil) + + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(nil, res, errors.New("some error")) }, wantErr: "failed creating the project projectName under username: some error", }, @@ -87,15 +103,20 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "username", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) p := &gl.Project{WebURL: "http://gitlab.com/username/projectName"} createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), Visibility: gl.Visibility(gl.PublicVisibility), } - c.On("CreateProject", &createOpts).Return(p, nil, nil) + + c.EXPECT().CurrentUser(). + Times(1). + Return(u, nil, nil) + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(p, nil, nil) }, want: "http://gitlab.com/username/projectName", }, @@ -104,21 +125,27 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "org", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) + c.EXPECT().CurrentUser().Return(u, nil, nil) p := &gl.Project{WebURL: "http://gitlab.com/org/projectName"} g := []*gl.Group{{FullPath: "org", ID: 1}} - c.On("ListGroups", &gl.ListGroupsOptions{ - MinAccessLevel: gl.AccessLevel(gl.DeveloperPermissions), - TopLevelOnly: gl.Bool(false), - }).Return(g, nil, nil) createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), Visibility: gl.Visibility(gl.PublicVisibility), NamespaceID: gl.Int(1), } - c.On("CreateProject", &createOpts).Return(p, nil, nil) + + c.EXPECT().ListGroups(&gl.ListGroupsOptions{ + MinAccessLevel: gl.AccessLevel(gl.DeveloperPermissions), + TopLevelOnly: gl.Bool(false), + }). + Times(1). + Return(g, nil, nil) + + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(p, nil, nil) }, want: "http://gitlab.com/org/projectName", }, @@ -127,21 +154,27 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "org/subOrg", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) + c.EXPECT().CurrentUser().Return(u, nil, nil) p := &gl.Project{WebURL: "http://gitlab.com/org/subOrg/projectName"} g := []*gl.Group{{FullPath: "org/subOrg", ID: 1}} - c.On("ListGroups", &gl.ListGroupsOptions{ - MinAccessLevel: gl.AccessLevel(gl.DeveloperPermissions), - TopLevelOnly: gl.Bool(false), - }).Return(g, nil, nil) createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), Visibility: gl.Visibility(gl.PublicVisibility), NamespaceID: gl.Int(1), } - c.On("CreateProject", &createOpts).Return(p, nil, nil) + + c.EXPECT().ListGroups(&gl.ListGroupsOptions{ + MinAccessLevel: gl.AccessLevel(gl.DeveloperPermissions), + TopLevelOnly: gl.Bool(false), + }). + Times(1). + Return(g, nil, nil) + + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(p, nil, nil) }, want: "http://gitlab.com/org/subOrg/projectName", }, @@ -151,9 +184,8 @@ func Test_gitlab_CreateRepository(t *testing.T) { Owner: "username", Private: true, }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) p := &gl.Project{WebURL: "http://gitlab.com/username/projectName"} createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), @@ -162,7 +194,13 @@ func Test_gitlab_CreateRepository(t *testing.T) { res := &gl.Response{ Response: &http.Response{}, } - c.On("CreateProject", &createOpts).Return(p, res, nil) + + c.EXPECT().CurrentUser(). + Times(1). + Return(u, nil, nil) + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(p, res, nil) }, want: "http://gitlab.com/username/projectName", }, @@ -171,9 +209,8 @@ func Test_gitlab_CreateRepository(t *testing.T) { Name: "projectName", Owner: "username", }, - beforeFn: func(c *glmocks.GitlabClient) { + beforeFn: func(c *glmocks.MockGitlabClient) { u := &gl.User{Username: "username"} - c.On("CurrentUser").Return(u, nil, nil) p := &gl.Project{WebURL: ""} createOpts := gl.CreateProjectOptions{ Name: gl.String("projectName"), @@ -182,7 +219,12 @@ func Test_gitlab_CreateRepository(t *testing.T) { res := &gl.Response{ Response: &http.Response{}, } - c.On("CreateProject", &createOpts).Return(p, res, nil) + c.EXPECT().CurrentUser(). + Times(1). + Return(u, nil, nil) + c.EXPECT().CreateProject(&createOpts). + Times(1). + Return(p, res, nil) }, wantErr: "project url is empty", want: "", @@ -190,14 +232,13 @@ func Test_gitlab_CreateRepository(t *testing.T) { } for name, tt := range tests { t.Run(name, func(t *testing.T) { - mockClient := &glmocks.GitlabClient{} + mockClient := glmocks.NewMockGitlabClient(gomock.NewController(t)) tt.beforeFn(mockClient) g := &gitlab{ client: mockClient, } got, err := g.CreateRepository(context.Background(), tt.opts) - mockClient.AssertExpectations(t) if err != nil { if tt.wantErr != "" { assert.EqualError(t, err, tt.wantErr) diff --git a/pkg/git/repository.go b/pkg/git/repository.go index e28ba04b..606aeb65 100644 --- a/pkg/git/repository.go +++ b/pkg/git/repository.go @@ -28,8 +28,9 @@ import ( "github.com/spf13/viper" ) -//go:generate mockery --dir gogit --all --output gogit/mocks --case snake -//go:generate mockery --name Repository --filename repository.go +//go:generate mockgen -destination=./mocks/repository.go -package=mocks -source=./repository.go Repository +//go:generate mockgen -destination=./gogit/mocks/repository.go -package=mocks -source=./gogit/repo.go Repository +//go:generate mockgen -destination=./gogit/mocks/worktree.go -package=mocks -source=./gogit/worktree.go Worktree type ( // Repository represents a git repository diff --git a/pkg/git/repository_test.go b/pkg/git/repository_test.go index 826ce46c..e54eee93 100644 --- a/pkg/git/repository_test.go +++ b/pkg/git/repository_test.go @@ -11,6 +11,9 @@ import ( "github.com/argoproj-labs/argocd-autopilot/pkg/fs" "github.com/argoproj-labs/argocd-autopilot/pkg/git/gogit" "github.com/argoproj-labs/argocd-autopilot/pkg/git/gogit/mocks" + "github.com/golang/mock/gomock" + "github.com/spf13/cobra" + "github.com/spf13/viper" billy "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" @@ -20,10 +23,7 @@ import ( "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/storage" - "github.com/spf13/cobra" - "github.com/spf13/viper" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" ) func Test_repo_addRemote(t *testing.T) { @@ -64,18 +64,18 @@ func Test_repo_addRemote(t *testing.T) { for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := &mocks.Repository{} - mockRepo.On("CreateRemote", mock.Anything).Return(nil, tt.retErr) + mockRepo := mocks.NewMockRepository(gomock.NewController(t)) + mockRepo.EXPECT().CreateRemote(&config.RemoteConfig{ + Name: tt.args.name, + URLs: []string{tt.args.url}, + }). + Times(1). + Return(nil, tt.retErr) r := &repo{Repository: mockRepo} if err := r.addRemote(tt.args.name, tt.args.url); (err != nil) != tt.wantErr { t.Errorf("repo.addRemote() error = %v, wantErr %v", err, tt.wantErr) } - - mockRepo.AssertCalled(t, "CreateRemote", mock.Anything) - - actualCfg := mockRepo.Calls[0].Arguments.Get(0).(*config.RemoteConfig) - assert.Equal(t, tt.expectedCfg.Name, actualCfg.Name) }) } } @@ -114,33 +114,34 @@ func Test_repo_initBranch(t *testing.T) { branchName string wantErr bool retErr error - assertFn func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) + assertFn func(t *testing.T, r *mocks.MockRepository, wt *mocks.MockWorktree) }{ "Init current branch": { branchName: "", - assertFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertNotCalled(t, "Worktree") - wt.AssertCalled(t, "Commit", "initial commit", mock.Anything) - wt.AssertNotCalled(t, "Checkout") + assertFn: func(t *testing.T, r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().Worktree().Times(0) + wt.EXPECT().Commit("initial commit", gomock.Any()).Times(1) + wt.EXPECT().Checkout(gomock.Any()).Times(0) }, }, "Init and checkout branch": { - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertCalled(t, "Commit", "initial commit", mock.Anything) + assertFn: func(t *testing.T, _ *mocks.MockRepository, wt *mocks.MockWorktree) { b := plumbing.NewBranchReferenceName("test") - wt.AssertCalled(t, "Checkout", &gg.CheckoutOptions{ - Branch: b, - Create: true, - }) + wt.EXPECT().Commit("initial commit", gomock.Any()). + Times(1) + wt.EXPECT().Checkout(&gg.CheckoutOptions{Branch: b, Create: true}). + Times(1) }, }, "Error": { branchName: "test", wantErr: true, retErr: fmt.Errorf("error"), - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertCalled(t, "Commit", "initial commit", mock.Anything) - wt.AssertNotCalled(t, "Checkout") + assertFn: func(t *testing.T, _ *mocks.MockRepository, wt *mocks.MockWorktree) { + wt.EXPECT().Commit("initial commit", gomock.Any()). + Times(1) + wt.EXPECT().Checkout(gomock.Any()). + Times(0) }, }, } @@ -149,10 +150,13 @@ func Test_repo_initBranch(t *testing.T) { defer func() { worktree = orgWorktree }() for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := &mocks.Repository{} - mockWt := &mocks.Worktree{} - mockWt.On("Commit", mock.Anything, mock.Anything).Return(nil, tt.retErr) - mockWt.On("Checkout", mock.Anything).Return(tt.retErr) + ctrl := gomock.NewController(t) + mockRepo := mocks.NewMockRepository(ctrl) + mockWt := mocks.NewMockWorktree(ctrl) + + mockWt.EXPECT().Commit(gomock.Any(), gomock.Any()).Return(plumbing.Hash{}, tt.retErr).AnyTimes() + mockWt.EXPECT().Checkout(gomock.Any()).Return(tt.retErr).AnyTimes() + mockWt.EXPECT().AddGlob(gomock.Any()).Return(tt.retErr).AnyTimes() gitConfig := &config.Config{ User: struct { @@ -164,8 +168,7 @@ func Test_repo_initBranch(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(gitConfig, nil) - mockWt.On("AddGlob", mock.Anything).Return(tt.retErr) + mockRepo.EXPECT().ConfigScoped(gomock.Any()).Return(gitConfig, nil).AnyTimes() worktree = func(r gogit.Repository) (gogit.Worktree, error) { return mockWt, nil } @@ -184,16 +187,15 @@ func Test_initRepo(t *testing.T) { want Repository wantErr bool retErr error - assertFn func(t *testing.T, r *mocks.Repository, w *mocks.Worktree) + assertFn func(t *testing.T, r *mocks.MockRepository, w *mocks.MockWorktree) }{ "Basic": { opts: &CloneOptions{ Repo: "https://github.com/owner/name?ref=test", }, - assertFn: func(t *testing.T, r *mocks.Repository, w *mocks.Worktree) { - r.AssertCalled(t, "CreateRemote") - w.AssertCalled(t, "Commit") - w.AssertCalled(t, "Commit") + assertFn: func(t *testing.T, r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().CreateRemote(gomock.Any()).Times(1) + w.EXPECT().Commit(gomock.Any(), gomock.Any()).Times(2) }, }, "Error": { @@ -202,10 +204,9 @@ func Test_initRepo(t *testing.T) { }, retErr: fmt.Errorf("error"), wantErr: true, - assertFn: func(t *testing.T, r *mocks.Repository, w *mocks.Worktree) { - r.AssertCalled(t, "CreateRemote", mock.Anything) - w.AssertNotCalled(t, "Commit") - w.AssertNotCalled(t, "Commit") + assertFn: func(t *testing.T, r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().CreateRemote(gomock.Any()).Times(1) + w.EXPECT().Commit(gomock.Any(), gomock.Any()).Times(0) }, }, } @@ -216,11 +217,13 @@ func Test_initRepo(t *testing.T) { defer func() { worktree = orgWorktree }() for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := &mocks.Repository{} - mockRepo.On("CreateRemote", mock.Anything).Return(nil, tt.retErr) - mockWt := &mocks.Worktree{} - mockWt.On("Commit", mock.Anything, mock.Anything).Return(nil, tt.retErr) - mockWt.On("Checkout", mock.Anything).Return(tt.retErr) + ctrl := gomock.NewController(t) + mockRepo := mocks.NewMockRepository(ctrl) + mockWt := mocks.NewMockWorktree(ctrl) + + mockRepo.EXPECT().CreateRemote(gomock.Any()).Return(nil, tt.retErr).AnyTimes() + mockWt.EXPECT().Commit(gomock.Any(), gomock.Any()).Return(plumbing.Hash{}, tt.retErr).AnyTimes() + mockWt.EXPECT().Checkout(gomock.Any()).Return(tt.retErr).AnyTimes() ggInitRepo = func(s storage.Storer, worktree billy.Filesystem) (gogit.Repository, error) { return mockRepo, nil } worktree = func(r gogit.Repository) (gogit.Worktree, error) { return mockWt, nil } @@ -235,8 +238,8 @@ func Test_initRepo(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(cfg, nil) - mockWt.On("AddGlob", mock.Anything).Return(tt.retErr) + mockRepo.EXPECT().ConfigScoped(gomock.Any()).Return(cfg, nil).AnyTimes() + mockWt.EXPECT().AddGlob(gomock.Any()).Return(tt.retErr).AnyTimes() tt.opts.Parse() got, err := initRepo(context.Background(), tt.opts) @@ -423,7 +426,7 @@ func Test_clone(t *testing.T) { for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := &mocks.Repository{} + mockRepo := mocks.NewMockRepository(gomock.NewController(t)) cloneCalls := 0 ggClone = func(_ context.Context, _ storage.Storer, _ billy.Filesystem, o *gg.CloneOptions) (gogit.Repository, error) { cloneCalls++ @@ -606,17 +609,16 @@ func Test_repo_Persist(t *testing.T) { tests := map[string]struct { opts *PushOptions retRevision string - retErr error - assertFn func(t *testing.T, r *mocks.Repository, w *mocks.Worktree, revision string, err error) + wantErr bool + beforeFn func(r *mocks.MockRepository, w *mocks.MockWorktree) }{ "NilOpts": { - opts: nil, - assertFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree, revision string, err error) { - assert.ErrorIs(t, err, ErrNilOpts) - assert.Equal(t, "", revision) - wt.AssertNotCalled(t, "AddGlob") - wt.AssertNotCalled(t, "Commit") - r.AssertNotCalled(t, "PushContext") + opts: nil, + wantErr: true, + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + wt.EXPECT().AddGlob(gomock.Any()).Times(0) + wt.EXPECT().Commit(gomock.Any(), gomock.Any()).Times(0) + r.EXPECT().PushContext(gomock.Any(), gomock.Any()).Times(0) }, }, "Default add pattern": { @@ -625,15 +627,19 @@ func Test_repo_Persist(t *testing.T) { CommitMsg: "hello", }, retRevision: "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", - assertFn: func(t *testing.T, r *mocks.Repository, w *mocks.Worktree, revision string, err error) { - assert.Equal(t, "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", revision) - assert.Nil(t, err) - r.AssertCalled(t, "PushContext", mock.Anything, &gg.PushOptions{ + beforeFn: func(r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().PushContext(gomock.Any(), &gg.PushOptions{ Auth: nil, Progress: os.Stderr, - }) - w.AssertCalled(t, "AddGlob", ".") - w.AssertCalled(t, "Commit", "hello", mock.Anything) + }). + Times(1). + Return(nil) + w.EXPECT().AddGlob("."). + Times(1). + Return(nil) + w.EXPECT().Commit("hello", gomock.Any()). + Times(1). + Return(plumbing.NewHash("0dee45f70b37aeb59e6d2efb29855f97df9bccb2"), nil) }, }, "With add pattern": { @@ -642,15 +648,19 @@ func Test_repo_Persist(t *testing.T) { CommitMsg: "hello", }, retRevision: "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", - assertFn: func(t *testing.T, r *mocks.Repository, w *mocks.Worktree, revision string, err error) { - assert.Equal(t, "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", revision) - assert.Nil(t, err) - r.AssertCalled(t, "PushContext", mock.Anything, &gg.PushOptions{ + beforeFn: func(r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().PushContext(gomock.Any(), &gg.PushOptions{ Auth: nil, Progress: os.Stderr, - }) - w.AssertCalled(t, "AddGlob", "test") - w.AssertCalled(t, "Commit", "hello", mock.Anything) + }). + Times(1). + Return(nil) + w.EXPECT().AddGlob("test"). + Times(1). + Return(nil) + w.EXPECT().Commit("hello", gomock.Any()). + Times(1). + Return(plumbing.NewHash("0dee45f70b37aeb59e6d2efb29855f97df9bccb2"), nil) }, }, "Retry push on 'repo not found err'": { @@ -658,18 +668,43 @@ func Test_repo_Persist(t *testing.T) { AddGlobPattern: "test", CommitMsg: "hello", }, - retErr: transport.ErrRepositoryNotFound, retRevision: "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", - assertFn: func(t *testing.T, r *mocks.Repository, w *mocks.Worktree, revision string, err error) { - assert.Equal(t, "0dee45f70b37aeb59e6d2efb29855f97df9bccb2", revision) - assert.Error(t, err, transport.ErrRepositoryNotFound) - r.AssertCalled(t, "PushContext", mock.Anything, &gg.PushOptions{ + beforeFn: func(r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().PushContext(gomock.Any(), &gg.PushOptions{ Auth: nil, Progress: os.Stderr, - }) - r.AssertNumberOfCalls(t, "PushContext", 3) - w.AssertCalled(t, "AddGlob", "test") - w.AssertCalled(t, "Commit", "hello", mock.Anything) + }). + Times(1). + Return(transport.ErrRepositoryNotFound). + Times(1). + Return(nil) + w.EXPECT().AddGlob("test"). + Times(1). + Return(nil) + w.EXPECT().Commit("hello", gomock.Any()). + Times(1). + Return(plumbing.NewHash("0dee45f70b37aeb59e6d2efb29855f97df9bccb2"), nil) + }, + }, + "Fail after 3 retries with 'repo not found err'": { + opts: &PushOptions{ + AddGlobPattern: "test", + CommitMsg: "hello", + }, + wantErr: true, + beforeFn: func(r *mocks.MockRepository, w *mocks.MockWorktree) { + r.EXPECT().PushContext(gomock.Any(), &gg.PushOptions{ + Auth: nil, + Progress: os.Stderr, + }). + Times(3). + Return(transport.ErrRepositoryNotFound) + w.EXPECT().AddGlob("test"). + Times(1). + Return(nil) + w.EXPECT().Commit("hello", gomock.Any()). + Times(1). + Return(plumbing.NewHash("0dee45f70b37aeb59e6d2efb29855f97df9bccb2"), nil) }, }, } @@ -689,21 +724,28 @@ func Test_repo_Persist(t *testing.T) { for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := &mocks.Repository{} - mockRepo.On("PushContext", mock.Anything, mock.Anything).Return(tt.retErr) - mockRepo.On("ConfigScoped", mock.Anything).Return(gitConfig, nil) + ctrl := gomock.NewController(t) + mockRepo := mocks.NewMockRepository(ctrl) + mockWt := mocks.NewMockWorktree(ctrl) - mockWt := &mocks.Worktree{} - mockWt.On("AddGlob", mock.Anything).Return(nil) - mockWt.On("Commit", mock.Anything, mock.Anything).Return(plumbing.NewHash(tt.retRevision), nil) + mockRepo.EXPECT().ConfigScoped(gomock.Any()).Return(gitConfig, nil).AnyTimes() r := &repo{Repository: mockRepo, progress: os.Stderr} worktree = func(r gogit.Repository) (gogit.Worktree, error) { return mockWt, nil } + tt.beforeFn(mockRepo, mockWt) + revision, err := r.Persist(context.Background(), tt.opts) - tt.assertFn(t, mockRepo, mockWt, revision, err) + if (err != nil) != tt.wantErr { + t.Errorf("error = %v, wantErr %v", err, tt.wantErr) + return + } + + if !tt.wantErr { + assert.Equal(t, tt.retRevision, revision) + } }) } } @@ -713,90 +755,102 @@ func Test_repo_checkoutRef(t *testing.T) { ref string hash string wantErr string - beforeFn func() *mocks.Repository + beforeFn func(*mocks.MockRepository) }{ "Should checkout a specific hash": { ref: "3992c4", hash: "3992c4", - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} + beforeFn: func(r *mocks.MockRepository) { hash := plumbing.NewHash("3992c4") - r.On("ResolveRevision", plumbing.Revision("3992c4")).Return(&hash, nil) - return r + r.EXPECT().ResolveRevision(plumbing.Revision("3992c4")). + Times(1). + Return(&hash, nil) }, }, "Should checkout a tag": { ref: "v1.0.0", hash: "3992c4", - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} + beforeFn: func(r *mocks.MockRepository) { hash := plumbing.NewHash("3992c4") - r.On("ResolveRevision", plumbing.Revision("v1.0.0")).Return(&hash, nil) - return r + r.EXPECT().ResolveRevision(plumbing.Revision("v1.0.0")). + Times(1). + Return(&hash, nil) }, }, "Should checkout a branch": { ref: "CR-1234", hash: "3992c4", - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} - r.On("ResolveRevision", plumbing.Revision("CR-1234")).Return(nil, plumbing.ErrReferenceNotFound) - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) + beforeFn: func(r *mocks.MockRepository) { + r.EXPECT().ResolveRevision(plumbing.Revision("CR-1234")). + Times(1). + Return(nil, plumbing.ErrReferenceNotFound) + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) hash := plumbing.NewHash("3992c4") - r.On("ResolveRevision", plumbing.Revision("origin/CR-1234")).Return(&hash, nil) - return r + r.EXPECT().ResolveRevision(plumbing.Revision("origin/CR-1234")). + Times(1). + Return(&hash, nil) }, }, "Should fail if ResolveRevision fails": { ref: "CR-1234", hash: "3992c4", wantErr: "some error", - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} - r.On("ResolveRevision", plumbing.Revision("CR-1234")).Return(nil, errors.New("some error")) - return r + beforeFn: func(r *mocks.MockRepository) { + r.EXPECT().ResolveRevision(plumbing.Revision("CR-1234")). + Times(1). + Return(nil, errors.New("some error")) }, }, "Should fail if Remotes fails": { ref: "CR-1234", hash: "3992c4", wantErr: "some error", - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} - r.On("ResolveRevision", plumbing.Revision("CR-1234")).Return(nil, plumbing.ErrReferenceNotFound) - r.On("Remotes").Return(nil, errors.New("some error")) - return r + beforeFn: func(r *mocks.MockRepository) { + r.EXPECT().ResolveRevision(plumbing.Revision("CR-1234")). + Times(1). + Return(nil, plumbing.ErrReferenceNotFound) + r.EXPECT().Remotes(). + Times(1). + Return(nil, errors.New("some error")) }, }, "Should fail if repo has no remotes": { ref: "CR-1234", hash: "3992c4", wantErr: ErrNoRemotes.Error(), - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} - r.On("ResolveRevision", plumbing.Revision("CR-1234")).Return(nil, plumbing.ErrReferenceNotFound) - r.On("Remotes").Return([]*gg.Remote{}, nil) - return r + beforeFn: func(r *mocks.MockRepository) { + r.EXPECT().ResolveRevision(plumbing.Revision("CR-1234")). + Times(1). + Return(nil, plumbing.ErrReferenceNotFound) + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{}, nil) }, }, "Should fail if branch not found": { ref: "CR-1234", hash: "3992c4", wantErr: plumbing.ErrReferenceNotFound.Error(), - beforeFn: func() *mocks.Repository { - r := &mocks.Repository{} - r.On("ResolveRevision", plumbing.Revision("CR-1234")).Return(nil, plumbing.ErrReferenceNotFound) - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) - r.On("ResolveRevision", plumbing.Revision("origin/CR-1234")).Return(nil, plumbing.ErrReferenceNotFound) - return r + beforeFn: func(r *mocks.MockRepository) { + r.EXPECT().ResolveRevision(plumbing.Revision("CR-1234")). + Times(1). + Return(nil, plumbing.ErrReferenceNotFound) + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) + r.EXPECT().ResolveRevision(plumbing.Revision("origin/CR-1234")). + Times(1). + Return(nil, plumbing.ErrReferenceNotFound) }, }, } @@ -804,15 +858,19 @@ func Test_repo_checkoutRef(t *testing.T) { defer func() { worktree = origWorktree }() for name, tt := range tests { t.Run(name, func(t *testing.T) { - mockwt := &mocks.Worktree{} + ctrl := gomock.NewController(t) + mockwt := mocks.NewMockWorktree(ctrl) + mockRepo := mocks.NewMockRepository(ctrl) worktree = func(r gogit.Repository) (gogit.Worktree, error) { return mockwt, nil } - mockwt.On("Checkout", &gg.CheckoutOptions{ - Hash: plumbing.NewHash(tt.hash), - }).Return(nil) - mockrepo := tt.beforeFn() - r := &repo{Repository: mockrepo} + mockwt.EXPECT().Checkout(&gg.CheckoutOptions{Hash: plumbing.NewHash(tt.hash)}). + Return(nil). + AnyTimes() + + tt.beforeFn(mockRepo) + r := &repo{Repository: mockRepo} + if err := r.checkoutRef(tt.ref); err != nil { if tt.wantErr != "" { assert.EqualError(t, err, tt.wantErr) @@ -822,9 +880,6 @@ func Test_repo_checkoutRef(t *testing.T) { return } - - mockrepo.AssertExpectations(t) - mockwt.AssertExpectations(t) }) } } @@ -834,176 +889,159 @@ func Test_repo_checkoutBranch(t *testing.T) { ref string createIfNotExists bool wantErr string - beforeFn func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) - afterFn func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) + beforeFn func(*mocks.MockRepository, *mocks.MockWorktree) }{ "Should checkout a specific branch": { ref: "test", - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(nil) - - return r, wt - }, - afterFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - wt.AssertNumberOfCalls(t, "Checkout", 1) + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("test"), + }). + Times(1). + Return(nil) }, }, "Should fail if Checkout fails without create": { ref: "CR-1234", wantErr: plumbing.ErrReferenceNotFound.Error(), - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewRemoteReferenceName("origin", ref), - }).Return(plumbing.ErrReferenceNotFound) - - return r, wt - }, - afterFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertNumberOfCalls(t, "Remotes", 1) - wt.AssertNumberOfCalls(t, "Checkout", 2) + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewRemoteReferenceName("origin", "CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) }, }, "Should fail if Remotes fails": { ref: "CR-1234", wantErr: "some error", - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) - r.On("Remotes").Return(nil, fmt.Errorf("some error")) - - return r, wt + r.EXPECT().Remotes(). + Times(1). + Return(nil, fmt.Errorf("some error")) }, }, "Should fail if repo has no remotes": { ref: "CR-1234", wantErr: ErrNoRemotes.Error(), - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) - r.On("Remotes").Return([]*gg.Remote{}, nil) - - return r, wt + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{}, nil) }, }, "Should create local branch if succeeded to checkout remote branch": { ref: "CR-1234", - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewRemoteReferenceName("origin", ref), - }).Return(nil) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewRemoteReferenceName("origin", "CR-1234"), + }). + Times(1). + Return(nil) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), Create: true, - }).Return(nil) - - return r, wt - }, - afterFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertNumberOfCalls(t, "Remotes", 1) - wt.AssertNumberOfCalls(t, "Checkout", 3) + }). + Times(1). + Return(nil) }, }, "Should create local branch if remote branch is not found and create is true": { ref: "CR-1234", createIfNotExists: true, - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewRemoteReferenceName("origin", ref), - }).Return(plumbing.ErrReferenceNotFound) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewRemoteReferenceName("origin", "CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), Create: true, - }).Return(nil) - - return r, wt - }, - afterFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertNumberOfCalls(t, "Remotes", 1) - wt.AssertNumberOfCalls(t, "Checkout", 3) + }). + Times(1). + Return(nil) }, }, "Should fail if cannot checkout remote branch for some reason": { ref: "CR-1234", wantErr: "some error", - beforeFn: func(t *testing.T, ref string) (*mocks.Repository, *mocks.Worktree) { - r := &mocks.Repository{} - wt := &mocks.Worktree{} - - r.On("Remotes").Return([]*gg.Remote{ - gg.NewRemote(nil, &config.RemoteConfig{ - Name: "origin", - }), - }, nil) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewBranchReferenceName(ref), - }).Return(plumbing.ErrReferenceNotFound) - - wt.On("Checkout", &gg.CheckoutOptions{ - Branch: plumbing.NewRemoteReferenceName("origin", ref), - }).Return(fmt.Errorf("some error")) - - return r, wt - }, - afterFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertNumberOfCalls(t, "Remotes", 1) - wt.AssertNumberOfCalls(t, "Checkout", 2) + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().Remotes(). + Times(1). + Return([]*gg.Remote{ + gg.NewRemote(nil, &config.RemoteConfig{ + Name: "origin", + }), + }, nil) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewBranchReferenceName("CR-1234"), + }). + Times(1). + Return(plumbing.ErrReferenceNotFound) + + wt.EXPECT().Checkout(&gg.CheckoutOptions{ + Branch: plumbing.NewRemoteReferenceName("origin", "CR-1234"), + }). + Times(1). + Return(fmt.Errorf("some error")) }, }, } @@ -1011,7 +1049,11 @@ func Test_repo_checkoutBranch(t *testing.T) { defer func() { worktree = origWorktree }() for name, tt := range tests { t.Run(name, func(t *testing.T) { - mockRepo, mockWT := tt.beforeFn(t, tt.ref) + ctrl := gomock.NewController(t) + mockRepo := mocks.NewMockRepository(ctrl) + mockWT := mocks.NewMockWorktree(ctrl) + tt.beforeFn(mockRepo, mockWT) + r := &repo{Repository: mockRepo} worktree = func(r gogit.Repository) (gogit.Worktree, error) { return mockWT, nil @@ -1026,8 +1068,6 @@ func Test_repo_checkoutBranch(t *testing.T) { return } - - tt.afterFn(t, mockRepo, mockWT) }) } } @@ -1259,21 +1299,12 @@ func Test_repo_commit(t *testing.T) { branchName string wantErr string retErr error - assertFn func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) - beforeFn func() *mocks.Repository + beforeFn func(r *mocks.MockRepository, wt *mocks.MockWorktree) }{ "Success": { branchName: "", - beforeFn: func() *mocks.Repository { - mockRepo := &mocks.Repository{} - mockWt := &mocks.Worktree{} + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { hash := plumbing.NewHash("3992c4") - mockWt.On("Commit", "test", mock.Anything).Return(hash, nil) - mockWt.On("AddGlob", mock.Anything).Return(nil) - worktree = func(r gogit.Repository) (gogit.Worktree, error) { - return mockWt, nil - } - config := &config.Config{ User: struct { Name string @@ -1284,20 +1315,21 @@ func Test_repo_commit(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(config, nil) + wt.EXPECT().Commit("test", gomock.Any()). + Times(1). + Return(hash, nil) + wt.EXPECT().AddGlob(gomock.Any()). + Times(1). + Return(nil) - return mockRepo - }, - assertFn: func(t *testing.T, r *mocks.Repository, wt *mocks.Worktree) { - r.AssertCalled(t, "Worktree") - wt.AssertCalled(t, "Commit", "initial commit", mock.Anything) + r.EXPECT().ConfigScoped(gomock.Any()). + Times(1). + Return(config, nil) }, }, "Error - no gitconfig name and email": { branchName: "test", - beforeFn: func() *mocks.Repository { - mockRepo := &mocks.Repository{} - + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { config := &config.Config{ User: struct { Name string @@ -1308,34 +1340,30 @@ func Test_repo_commit(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(config, nil) - - return mockRepo + r.EXPECT().ConfigScoped(gomock.Any()). + Times(1). + Return(config, nil) + wt.EXPECT().Commit(gomock.Any(), gomock.Any()). + Times(0) }, wantErr: "failed to commit. Please make sure your gitconfig contains a name and an email", - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertNotCalled(t, "Commit", "initial commit", mock.Anything) - }, }, "Error - ConfigScope fails": { branchName: "test", - beforeFn: func() *mocks.Repository { - mockRepo := &mocks.Repository{} - mockRepo.On("ConfigScoped", mock.Anything).Return(nil, fmt.Errorf("test Config error")) - - return mockRepo + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { + r.EXPECT().ConfigScoped(gomock.Any()). + Times(1). + Return(nil, fmt.Errorf("test Config error")) + wt.EXPECT().Commit(gomock.Any(), gomock.Any()). + Times(0) }, wantErr: "failed to get gitconfig. Error: test Config error", - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertNotCalled(t, "Commit", "initial commit", mock.Anything) - }, }, "Error - AddGlob fails": { branchName: "test", - beforeFn: func() *mocks.Repository { - mockRepo := &mocks.Repository{} + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { config := &config.Config{ User: struct { Name string @@ -1346,32 +1374,22 @@ func Test_repo_commit(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(config, nil) - mockWt := &mocks.Worktree{} - mockWt.On("AddGlob", mock.Anything).Return(fmt.Errorf("add glob error")) - - worktree = func(r gogit.Repository) (gogit.Worktree, error) { - return mockWt, nil - } + r.EXPECT().ConfigScoped(gomock.Any()). + Times(1). + Return(config, nil) + wt.EXPECT().AddGlob(gomock.Any()). + Times(1). + Return(fmt.Errorf("add glob error")) - return mockRepo + wt.EXPECT().Commit(gomock.Any(), gomock.Any()). + Times(0) }, wantErr: "add glob error", - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertNotCalled(t, "Commit", "initial commit", mock.Anything) - }, }, "Error - Commit fails": { branchName: "test", - beforeFn: func() *mocks.Repository { - mockRepo := &mocks.Repository{} - mockWt := &mocks.Worktree{} - mockWt.On("AddGlob", mock.Anything).Return(nil) - worktree = func(r gogit.Repository) (gogit.Worktree, error) { - return mockWt, nil - } - + beforeFn: func(r *mocks.MockRepository, wt *mocks.MockWorktree) { config := &config.Config{ User: struct { Name string @@ -1382,15 +1400,17 @@ func Test_repo_commit(t *testing.T) { }, } - mockRepo.On("ConfigScoped", mock.Anything).Return(config, nil) - mockWt.On("Commit", "test", mock.Anything).Return(nil, fmt.Errorf("test Config error")) - - return mockRepo + r.EXPECT().ConfigScoped(gomock.Any()). + Times(1). + Return(config, nil) + wt.EXPECT().AddGlob(gomock.Any()). + Times(1). + Return(nil) + wt.EXPECT().Commit("test", gomock.Any()). + Times(1). + Return(plumbing.Hash{}, fmt.Errorf("test Config error")) }, wantErr: "test Config error", - assertFn: func(t *testing.T, _ *mocks.Repository, wt *mocks.Worktree) { - wt.AssertNotCalled(t, "Commit", "initial commit", mock.Anything) - }, }, } @@ -1398,14 +1418,18 @@ func Test_repo_commit(t *testing.T) { defer func() { worktree = orgWorktree }() for tname, tt := range tests { t.Run(tname, func(t *testing.T) { - mockRepo := tt.beforeFn() + ctrl := gomock.NewController(t) + mockRepo := mocks.NewMockRepository(ctrl) + mockWt := mocks.NewMockWorktree(ctrl) + r := &repo{Repository: mockRepo} + worktree = func(r gogit.Repository) (gogit.Worktree, error) { + return mockWt, nil + } - hash := plumbing.NewHash("3992c4") + tt.beforeFn(mockRepo, mockWt) - got, err := r.commit(&PushOptions{ - CommitMsg: "test", - }) + got, err := r.commit(&PushOptions{CommitMsg: "test"}) if err != nil { if tt.wantErr != "" { @@ -1417,6 +1441,7 @@ func Test_repo_commit(t *testing.T) { return } + hash := plumbing.NewHash("3992c4") assert.Equal(t, got, &hash) }) } diff --git a/pkg/kube/kube.go b/pkg/kube/kube.go index 2741e91f..55f04dcd 100644 --- a/pkg/kube/kube.go +++ b/pkg/kube/kube.go @@ -23,7 +23,7 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" ) -//go:generate mockery --name Factory --filename kube.go +//go:generate mockgen -destination=./mocks/kube.go -package=mocks -source=./kube.go Factory const ( defaultPollInterval = time.Second * 2 diff --git a/pkg/kube/mocks/kube.go b/pkg/kube/mocks/kube.go index 97336468..39d01bf9 100644 --- a/pkg/kube/mocks/kube.go +++ b/pkg/kube/mocks/kube.go @@ -1,123 +1,124 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./kube.go +// Package mocks is a generated GoMock package. package mocks import ( context "context" + reflect "reflect" kube "github.com/argoproj-labs/argocd-autopilot/pkg/kube" + gomock "github.com/golang/mock/gomock" kubernetes "k8s.io/client-go/kubernetes" - - mock "github.com/stretchr/testify/mock" - rest "k8s.io/client-go/rest" ) -// Factory is an autogenerated mock type for the Factory type -type Factory struct { - mock.Mock +// MockFactory is a mock of Factory interface. +type MockFactory struct { + ctrl *gomock.Controller + recorder *MockFactoryMockRecorder } -// Apply provides a mock function with given fields: ctx, manifests -func (_m *Factory) Apply(ctx context.Context, manifests []byte) error { - ret := _m.Called(ctx, manifests) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []byte) error); ok { - r0 = rf(ctx, manifests) - } else { - r0 = ret.Error(0) - } - - return r0 +// MockFactoryMockRecorder is the mock recorder for MockFactory. +type MockFactoryMockRecorder struct { + mock *MockFactory } -// Delete provides a mock function with given fields: _a0, _a1 -func (_m *Factory) Delete(_a0 context.Context, _a1 *kube.DeleteOptions) error { - ret := _m.Called(_a0, _a1) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kube.DeleteOptions) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 +// NewMockFactory creates a new mock instance. +func NewMockFactory(ctrl *gomock.Controller) *MockFactory { + mock := &MockFactory{ctrl: ctrl} + mock.recorder = &MockFactoryMockRecorder{mock} + return mock } -// KubernetesClientSet provides a mock function with given fields: -func (_m *Factory) KubernetesClientSet() (kubernetes.Interface, error) { - ret := _m.Called() +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockFactory) EXPECT() *MockFactoryMockRecorder { + return m.recorder +} - var r0 kubernetes.Interface - if rf, ok := ret.Get(0).(func() kubernetes.Interface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(kubernetes.Interface) - } - } +// Apply mocks base method. +func (m *MockFactory) Apply(ctx context.Context, manifests []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Apply", ctx, manifests) + ret0, _ := ret[0].(error) + return ret0 +} - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } +// Apply indicates an expected call of Apply. +func (mr *MockFactoryMockRecorder) Apply(ctx, manifests interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockFactory)(nil).Apply), ctx, manifests) +} - return r0, r1 +// Delete mocks base method. +func (m *MockFactory) Delete(arg0 context.Context, arg1 *kube.DeleteOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 } -// KubernetesClientSetOrDie provides a mock function with given fields: -func (_m *Factory) KubernetesClientSetOrDie() kubernetes.Interface { - ret := _m.Called() +// Delete indicates an expected call of Delete. +func (mr *MockFactoryMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockFactory)(nil).Delete), arg0, arg1) +} - var r0 kubernetes.Interface - if rf, ok := ret.Get(0).(func() kubernetes.Interface); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(kubernetes.Interface) - } - } +// KubernetesClientSet mocks base method. +func (m *MockFactory) KubernetesClientSet() (kubernetes.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "KubernetesClientSet") + ret0, _ := ret[0].(kubernetes.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0 +// KubernetesClientSet indicates an expected call of KubernetesClientSet. +func (mr *MockFactoryMockRecorder) KubernetesClientSet() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KubernetesClientSet", reflect.TypeOf((*MockFactory)(nil).KubernetesClientSet)) } -// ToRESTConfig provides a mock function with given fields: -func (_m *Factory) ToRESTConfig() (*rest.Config, error) { - ret := _m.Called() +// KubernetesClientSetOrDie mocks base method. +func (m *MockFactory) KubernetesClientSetOrDie() kubernetes.Interface { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "KubernetesClientSetOrDie") + ret0, _ := ret[0].(kubernetes.Interface) + return ret0 +} - var r0 *rest.Config - if rf, ok := ret.Get(0).(func() *rest.Config); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*rest.Config) - } - } +// KubernetesClientSetOrDie indicates an expected call of KubernetesClientSetOrDie. +func (mr *MockFactoryMockRecorder) KubernetesClientSetOrDie() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KubernetesClientSetOrDie", reflect.TypeOf((*MockFactory)(nil).KubernetesClientSetOrDie)) +} - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } +// ToRESTConfig mocks base method. +func (m *MockFactory) ToRESTConfig() (*rest.Config, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ToRESTConfig") + ret0, _ := ret[0].(*rest.Config) + ret1, _ := ret[1].(error) + return ret0, ret1 +} - return r0, r1 +// ToRESTConfig indicates an expected call of ToRESTConfig. +func (mr *MockFactoryMockRecorder) ToRESTConfig() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToRESTConfig", reflect.TypeOf((*MockFactory)(nil).ToRESTConfig)) } -// Wait provides a mock function with given fields: _a0, _a1 -func (_m *Factory) Wait(_a0 context.Context, _a1 *kube.WaitOptions) error { - ret := _m.Called(_a0, _a1) +// Wait mocks base method. +func (m *MockFactory) Wait(arg0 context.Context, arg1 *kube.WaitOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Wait", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *kube.WaitOptions) error); ok { - r0 = rf(_a0, _a1) - } else { - r0 = ret.Error(0) - } - - return r0 +// Wait indicates an expected call of Wait. +func (mr *MockFactoryMockRecorder) Wait(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Wait", reflect.TypeOf((*MockFactory)(nil).Wait), arg0, arg1) }