github.com/sirkon/goproxy@v1.4.8/internal/mocks/gitlabapi/gitlabapi.go (about) 1 package gitlabapi 2 3 import ( 4 "context" 5 "io" 6 7 "github.com/sirkon/gitlab" 8 "github.com/sirkon/gitlab/gitlabdata" 9 "github.com/stretchr/testify/mock" 10 ) 11 12 var _ gitlab.Client = &GitlabAPICLient{} 13 14 type GitlabAPICLient struct { 15 mock.Mock 16 } 17 18 func (g *GitlabAPICLient) Tags(ctx context.Context, project, tagPrefix string) ([]*gitlabdata.Tag, error) { 19 res := g.Called(project, tagPrefix) 20 return res.Get(0).([]*gitlabdata.Tag), res.Error(1) 21 } 22 23 func (g *GitlabAPICLient) File(ctx context.Context, project, path, ref string) ([]byte, error) { 24 res := g.Called(project, ref) 25 return res.Get(0).([]byte), res.Error(1) 26 } 27 28 func (g *GitlabAPICLient) ProjectInfo(ctx context.Context, project string) (*gitlabdata.Project, error) { 29 res := g.Called(project) 30 return res.Get(0).(*gitlabdata.Project), res.Error(1) 31 } 32 33 func (g *GitlabAPICLient) Archive(ctx context.Context, projectID int, ref string) (io.ReadCloser, error) { 34 res := g.Called(projectID, ref) 35 return res.Get(0).(io.ReadCloser), res.Error(1) 36 } 37 38 func (g *GitlabAPICLient) Commits(ctx context.Context, project string, ref string) ([]*gitlabdata.Commit, error) { 39 res := g.Called(project, ref) 40 return res.Get(0).([]*gitlabdata.Commit), res.Error(1) 41 }