Documentation
¶
Overview ¶
Package githubtest provides an in-memory GitHub server for tests.
Index ¶
Constants ¶
const Access = "fixture-only-token-not-a-real-credential"
Access is the only token the fake accepts; it is not a real credential.
const RepoID int64 = 41
RepoID is the numeric identity of the fixture repository.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Commit ¶
type Commit struct{ Tree, Parent string }
Commit is a fake commit: the tree it names and its parent.
type Fake ¶
type Fake struct {
Mu sync.Mutex
Private bool
Denied bool
Fail bool
Reject bool
LoseResponse bool
AfterCommit func()
Head string
Counter int
Writes int
BlobWrites int
Blobs map[string][]byte
Trees map[string]map[string]string
Commits map[string]Commit
Server *httptest.Server
Force bool
Name string
// Renamed is the repository's previous name after a rename on GitHub:
// requests for it answer with a redirect, as GitHub does.
Renamed string
RepoID int64
}
Fake is an in-memory GitHub REST and GraphQL server for tests. Its exported fields are fixture knobs; change them inside Modify.
func (*Fake) Modify ¶
func (f *Fake) Modify(fn func())
Modify runs fn while holding the fake's lock.
func (*Fake) Serve ¶
func (f *Fake) Serve(w http.ResponseWriter, r *http.Request)
Serve answers the GitHub API requests the client makes.
func (*Fake) WriteCount ¶
WriteCount returns the number of write requests served.