Documentation ¶
Overview ¶
Package testclient implements the used interfaces of github API client library and simulates the API answers for our tests
Index ¶
- Variables
- func New(_ context.Context, _ string) *client.Client
- type IssueService
- type PullRequestsService
- type RepoService
- func (g *RepoService) Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
- func (g *RepoService) GetCommit(ctx context.Context, owner, repo, sha string) (*github.RepositoryCommit, *github.Response, error)
- func (g *RepoService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*github.RepositoryRelease, *github.Response, error)
- func (g *RepoService) ListTags(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
- type ReturnValueStr
Constants ¶
This section is empty.
Variables ¶
var ReturnValue = ReturnValueStr{} // nolint: gochecknoglobals
ReturnValue controls the error return values of API calls for testclient instances created by New
Functions ¶
Types ¶
type IssueService ¶
type IssueService struct { Issues []*github.Issue ReturnValue ReturnValueStr }
IssueService simulates the github.IssuesService
func (*IssueService) ListByRepo ¶
func (g *IssueService) ListByRepo( ctx context.Context, owner string, repo string, opt *github.IssueListByRepoOptions, ) ([]*github.Issue, *github.Response, error)
ListByRepo simulates the (github.IssuesService) ListByRepo call
type PullRequestsService ¶
type PullRequestsService struct { PRs []*github.PullRequest ReturnValue ReturnValueStr }
PullRequestsService simulates the github.PullRequestsService
func (*PullRequestsService) List ¶
func (g *PullRequestsService) List( ctx context.Context, owner string, repo string, opt *github.PullRequestListOptions, ) ([]*github.PullRequest, *github.Response, error)
List simulates the (github.PullRequestsService) ListByRepo call
type RepoService ¶
type RepoService struct { RepositoryTags []*github.RepositoryTag RepositoryCommits map[string]*github.RepositoryCommit RepositoryReleases map[string]*github.RepositoryRelease ReturnValue ReturnValueStr }
RepoService simulates the github.RepositoriesService
func (*RepoService) Get ¶
func (g *RepoService) Get( ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
Get simulates the (github.RepositoriesService) Get call
func (*RepoService) GetCommit ¶
func (g *RepoService) GetCommit( ctx context.Context, owner, repo, sha string, ) (*github.RepositoryCommit, *github.Response, error)
GetCommit simulates the (github.RepositoriesService) GetCommit call
func (*RepoService) GetReleaseByTag ¶
func (g *RepoService) GetReleaseByTag( ctx context.Context, owner, repo, tag string, ) (*github.RepositoryRelease, *github.Response, error)
GetReleaseByTag simulates the (github.RepositoriesService) GetCommit call
func (*RepoService) ListTags ¶
func (g *RepoService) ListTags( ctx context.Context, owner, repo string, opt *github.ListOptions, ) ([]*github.RepositoryTag, *github.Response, error)
ListTags simulates the (github.RepositoriesService) ListTags call
type ReturnValueStr ¶
type ReturnValueStr struct { RepoServiceListTagsErr bool RepoServiceGetCommitsErr bool IssueServiceListByRepoErr bool PullRequestsListErr bool RepoServiceGetErr bool RepoServiceGetRespCode int }
ReturnValueStr represents the possible error controlling of API calls for testing if a field is set to true - return error, otherwise not