Documentation ¶
Overview ¶
Package contexttest provides utilities for testing Web/API contexts with models.
Index ¶
- func LoadGitRepo(t *testing.T, ctx *context.Context)
- func LoadRepo(t *testing.T, ctx gocontext.Context, repoID int64)
- func LoadRepoCommit(t *testing.T, ctx gocontext.Context)
- func LoadUser(t *testing.T, ctx gocontext.Context, userID int64)
- func MockAPIContext(t *testing.T, reqPath string) (*context.APIContext, *httptest.ResponseRecorder)
- func MockContext(t *testing.T, reqPath string, opts ...MockContextOption) (*context.Context, *httptest.ResponseRecorder)
- func MockPrivateContext(t *testing.T, reqPath string) (*context.PrivateContext, *httptest.ResponseRecorder)
- type MockContextOption
- type MockRender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadGitRepo ¶
LoadGitRepo load a git repo into a test context. Requires that ctx.Repo has already been populated.
func LoadRepoCommit ¶
LoadRepoCommit loads a repo's commit into a test context.
func MockAPIContext ¶
func MockAPIContext(t *testing.T, reqPath string) (*context.APIContext, *httptest.ResponseRecorder)
MockAPIContext mock context for unit tests
func MockContext ¶
func MockContext(t *testing.T, reqPath string, opts ...MockContextOption) (*context.Context, *httptest.ResponseRecorder)
MockContext mock context for unit tests
func MockPrivateContext ¶
func MockPrivateContext(t *testing.T, reqPath string) (*context.PrivateContext, *httptest.ResponseRecorder)
Types ¶
type MockContextOption ¶
type MockRender ¶
type MockRender struct{}
func (*MockRender) TemplateLookup ¶
func (tr *MockRender) TemplateLookup(tmpl string, _ gocontext.Context) (templates.TemplateExecutor, error)
Click to show internal directories.
Click to hide internal directories.