aboutsummaryrefslogtreecommitdiff
path: root/internal/gitutil/mock.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/gitutil/mock.go')
-rw-r--r--internal/gitutil/mock.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/gitutil/mock.go b/internal/gitutil/mock.go
new file mode 100644
index 00000000..6cd90dfa
--- /dev/null
+++ b/internal/gitutil/mock.go
@@ -0,0 +1,23 @@
+// Copyright 2020 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package gitutil
+
+import (
+ "github.com/gogs/git-module"
+)
+
+type MockModuleStore struct {
+ RepoAddRemote func(repoPath, name, url string, opts ...git.AddRemoteOptions) error
+ RepoDiffNameOnly func(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error)
+ RepoLog func(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error)
+ RepoMergeBase func(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error)
+ RepoRemoveRemote func(repoPath, name string, opts ...git.RemoveRemoteOptions) error
+ RepoTags func(repoPath string, opts ...git.TagsOptions) ([]string, error)
+}
+
+// MockModule holds mock implementation of each method for Modulers interface.
+// When the field is non-nil, it is considered mocked. Otherwise, the real
+// implementation will be executed.
+var MockModule MockModuleStore