Documentation
¶
Overview ¶
Package githubtest holds the fakes of internal/github that the test suites share: a token source that never reaches GitHub, the bookkeeping of a fake GitHub's requests, and GitHub's refusal of a token. internal/testutil cannot hold them, as internal/github imports it. Only tests may import this package.
Index ¶
Constants ¶
const Token = "test-token-not-real"
Token is the token a Tokens lends when it was given none: it never reaches GitHub.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Calls ¶
type Calls struct {
// contains filtered or unexported fields
}
Calls counts a fake GitHub's requests by name and keeps their order. Its zero value is ready to use, and it is safe for concurrent use.
type Tokens ¶
type Tokens struct {
// contains filtered or unexported fields
}
Tokens is a token source that lends tokens in turn and records the ones it is told to forget. It is safe for concurrent use; a test reads it with Loans and Forgot once the calls it made have returned.
func FailingTokens ¶
FailingTokens returns Tokens whose loans fail in turn with errs, a nil error lending values as NewTokens does, and every loan after the last of errs lending a token.
func NewTokens ¶
NewTokens returns Tokens that lend values in turn, the last of them again once the rest are lent, or Token when there are none.