-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitlab_mock.go
35 lines (28 loc) · 1.18 KB
/
gitlab_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/stretchr/testify/mock"
"github.com/xanzy/go-gitlab"
)
type gitLabClientMock struct {
mock.Mock
}
func (m *gitLabClientMock) listProjects(page int) ([]*gitlab.Project, gitLabPaging, error) {
args := m.Called(page)
return args.Get(0).([]*gitlab.Project), args.Get(1).(gitLabPaging), args.Error(2)
}
func (m *gitLabClientMock) listProjectsFromGroup(groupName string, page int) ([]*gitlab.Project, gitLabPaging, error) {
args := m.Called(groupName, page)
return args.Get(0).([]*gitlab.Project), args.Get(1).(gitLabPaging), args.Error(2)
}
func (m *gitLabClientMock) getProject(groupName string, projectName string) (*gitlab.Project, error) {
args := m.Called(groupName, projectName)
return args.Get(0).(*gitlab.Project), args.Error(1)
}
func (m *gitLabClientMock) getBuildDefinitionIfExists(projectID int, defaultBranch string) (string, error) {
args := m.Called(projectID, defaultBranch)
return args.String(0), args.Error(1)
}
func (m *gitLabClientMock) getBranches(gitLabProjectID int, page int) ([]*gitlab.Branch, gitLabPaging, error) {
args := m.Called(gitLabProjectID, page)
return args.Get(0).([]*gitlab.Branch), args.Get(1).(gitLabPaging), args.Error(2)
}