Documentation
¶
Overview ¶
Package hosttest fakes the pull request APIs of GitLab (REST v4), Gitea and Forgejo (/api/v1) and Bitbucket Cloud (2.0) for one repository, and optionally serves git over HTTP for it (git http-backend), so tests never call a real host.
h := hosttest.New(t, store.ProviderGitLab, "acme/shop", "Bearer gl-token") h.ServeGit(t, bareRepoDir, "oauth2", "gl-token") repo.BaseURL = h.URL
Index ¶
- type Host
- func (h *Host) Add(p PR)
- func (h *Host) Counts() (created, updated int)
- func (h *Host) GitRequests() []string
- func (h *Host) PR(n int) *PR
- func (h *Host) PRURL(n int) string
- func (h *Host) Requests() []string
- func (h *Host) ServeGit(t *testing.T, dir, user, pass string)
- func (h *Host) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Host) SetState(n int, state string)
- type PR
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
Kind store.Provider
Remote string // the repository's path on the host
Auth string // the Authorization header the API accepts
URL string // the fake's address: the repository's base URL
// contains filtered or unexported fields
}
Host is the fake. Its API checks the Authorization header.
func (*Host) GitRequests ¶
GitRequests lists the git requests as "PATH user:pass".