Documentation ¶
Index ¶
- func MakeJWT(user model.User) (string, error)
- type GitHubClient
- type GitHubClientMock
- func (mock *GitHubClientMock) ExchangeCodeToAccessKey(ctx context.Context, clientID string, clientSecret string, code string) (string, error)
- func (mock *GitHubClientMock) ExchangeCodeToAccessKeyCalls() []struct{ ... }
- func (mock *GitHubClientMock) GetUser(ctx context.Context, accessKey string, user string) (*github.User, error)
- func (mock *GitHubClientMock) GetUserCalls() []struct{ ... }
- func (mock *GitHubClientMock) IsMember(ctx context.Context, accessKey string, org string, user string) (bool, error)
- func (mock *GitHubClientMock) IsMemberCalls() []struct{ ... }
- type Service
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GitHubClient ¶
type GitHubClientMock ¶
type GitHubClientMock struct { // ExchangeCodeToAccessKeyFunc mocks the ExchangeCodeToAccessKey method. ExchangeCodeToAccessKeyFunc func(ctx context.Context, clientID string, clientSecret string, code string) (string, error) // GetUserFunc mocks the GetUser method. GetUserFunc func(ctx context.Context, accessKey string, user string) (*github.User, error) // IsMemberFunc mocks the IsMember method. IsMemberFunc func(ctx context.Context, accessKey string, org string, user string) (bool, error) // contains filtered or unexported fields }
GitHubClientMock is a mock implementation of GitHubClient.
func TestSomethingThatUsesGitHubClient(t *testing.T) { // make and configure a mocked GitHubClient mockedGitHubClient := &GitHubClientMock{ ExchangeCodeToAccessKeyFunc: func(ctx context.Context, clientID string, clientSecret string, code string) (string, error) { panic("mock out the ExchangeCodeToAccessKey method") }, GetUserFunc: func(ctx context.Context, accessKey string, user string) (*github.User, error) { panic("mock out the GetUser method") }, IsMemberFunc: func(ctx context.Context, accessKey string, org string, user string) (bool, error) { panic("mock out the IsMember method") }, } // use mockedGitHubClient in code that requires GitHubClient // and then make assertions. }
func (*GitHubClientMock) ExchangeCodeToAccessKey ¶
func (mock *GitHubClientMock) ExchangeCodeToAccessKey(ctx context.Context, clientID string, clientSecret string, code string) (string, error)
ExchangeCodeToAccessKey calls ExchangeCodeToAccessKeyFunc.
func (*GitHubClientMock) ExchangeCodeToAccessKeyCalls ¶
func (mock *GitHubClientMock) ExchangeCodeToAccessKeyCalls() []struct { Ctx context.Context ClientID string ClientSecret string Code string }
ExchangeCodeToAccessKeyCalls gets all the calls that were made to ExchangeCodeToAccessKey. Check the length with:
len(mockedGitHubClient.ExchangeCodeToAccessKeyCalls())
func (*GitHubClientMock) GetUser ¶
func (mock *GitHubClientMock) GetUser(ctx context.Context, accessKey string, user string) (*github.User, error)
GetUser calls GetUserFunc.
func (*GitHubClientMock) GetUserCalls ¶
func (mock *GitHubClientMock) GetUserCalls() []struct { Ctx context.Context AccessKey string User string }
GetUserCalls gets all the calls that were made to GetUser. Check the length with:
len(mockedGitHubClient.GetUserCalls())
func (*GitHubClientMock) IsMember ¶
func (mock *GitHubClientMock) IsMember(ctx context.Context, accessKey string, org string, user string) (bool, error)
IsMember calls IsMemberFunc.
func (*GitHubClientMock) IsMemberCalls ¶
func (mock *GitHubClientMock) IsMemberCalls() []struct { Ctx context.Context AccessKey string Org string User string }
IsMemberCalls gets all the calls that were made to IsMember. Check the length with:
len(mockedGitHubClient.IsMemberCalls())
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(githubClient GitHubClient, storage Storage, ghClientID, ghClientSecret string) *Service
func (*Service) GitHubAuthCallback ¶
func (*Service) GitHubAuthLink ¶
Click to show internal directories.
Click to hide internal directories.