instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL     string             `json:"url"`
	Session auth.SessionConfig `json:"session"`
}

Config is the structure of the configuration for a single GitHub instance.

type Instance

type Instance interface {
	GetName() string
	GetURL() string
	TokenToCookie(token *Token) (*http.Cookie, error)
	TokenFromCookie(r *http.Request) (*Token, error)
	GetSelf(ctx context.Context, token *Token) (*jira.User, error)
	GetProjects(ctx context.Context, token *Token) (*jira.ProjectList, error)
	GetIssues(ctx context.Context, token *Token, jql string, startAt, maxResults int) ([]jira.Issue, int, error)
}

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new GitHub instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetIssues

func (_m *MockInstance) GetIssues(ctx context.Context, token *Token, jql string, startAt int, maxResults int) ([]jira.Issue, int, error)

GetIssues provides a mock function with given fields: ctx, token, jql, startAt, maxResults

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetProjects

func (_m *MockInstance) GetProjects(ctx context.Context, token *Token) (*jira.ProjectList, error)

GetProjects provides a mock function with given fields: ctx, token

func (*MockInstance) GetSelf

func (_m *MockInstance) GetSelf(ctx context.Context, token *Token) (*jira.User, error)

GetSelf provides a mock function with given fields: ctx, token

func (*MockInstance) GetURL

func (_m *MockInstance) GetURL() string

GetURL provides a mock function with given fields:

func (*MockInstance) TokenFromCookie

func (_m *MockInstance) TokenFromCookie(r *http.Request) (*Token, error)

TokenFromCookie provides a mock function with given fields: r

func (*MockInstance) TokenToCookie

func (_m *MockInstance) TokenToCookie(token *Token) (*http.Cookie, error)

TokenToCookie provides a mock function with given fields: token

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type Token

type Token struct {
	Email string `json:"email"`
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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