githubservices

package
v0.0.0-...-89f4574 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Repositories repoService
	Users        userService
}

Client is a a wrapper around the GitHub client's RepositoriesService

func NewClient

func NewClient(httpClient *http.Client, repoMock repoService, userMock userService) Client

NewClient creates a wrapper around the GitHub client's RepositoriesService The RepositoriesService can be replaced for unit testing

type MockGithubRepositoryService

type MockGithubRepositoryService struct {
	Content    *github.RepositoryContent
	DirContent []*github.RepositoryContent
	Users      []*github.User
	Response   *github.Response
	Error      error
	Owner      string
	Repo       string
}

MockGithubRepositoryService is a struct that can replace github.RepositoriesService for testing

func (*MockGithubRepositoryService) Get

Get mocks the original github.RepositoriesService.Get() by returning the given mocked response and error

func (*MockGithubRepositoryService) GetContents

GetContents mocks the original github.RepositoriesService.GetContents() Checks whether the owner is correct and returns the mocked content, response and error

func (*MockGithubRepositoryService) ListByOrg

ListByOrg mocks the original github.RepositoriesService.ListByOrg() Checks whether the owner is correct and returns the mocked error

func (*MockGithubRepositoryService) ListCollaborators

func (mgc *MockGithubRepositoryService) ListCollaborators(ctx context.Context, owner, repo string, opts *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error)

ListCollaborators mocks the original github.RepositoriesService.ListCollaborators() Checks whether the owner is correct and returns the mocked error

type MockGithubUserService

type MockGithubUserService struct {
	Response *github.Response
	Error    error
	User     string
}

MockGithubUserService is a struct that can replace github.UsersService for testing

func (*MockGithubUserService) Get

Get mocks the original github.UsersService.Get() Checks whether the user is correct and returns the mocked response and error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL