 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func DecodeResponseToType(recorder *httptest.ResponseRecorder, target interface{}) error
- func MapFromJSON(data []byte) map[string]interface{}
- type AuthOptions
- type TestContextMiddleware
- type TestMiddleware
- type TestRequestBody
- type TestResource
- func (resource *TestResource) Context() domain.IContext
- func (resource *TestResource) HandleAllACL(req *http.Request, user domain.IUser) (bool, string)
- func (resource *TestResource) HandleGetRoute(w http.ResponseWriter, req *http.Request)
- func (resource *TestResource) HandlePostRoute(w http.ResponseWriter, req *http.Request)
- func (resource *TestResource) Render(w http.ResponseWriter, req *http.Request, status int, v interface{})
- func (resource *TestResource) Routes() *domain.Routes
 
- type TestResourceOptions
- type TestResponseBody
- type TestServer
- type TestServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeResponseToType ¶
func DecodeResponseToType(recorder *httptest.ResponseRecorder, target interface{}) error
DecodeResponseToType is a test helper function that decodes recorded response body to a specific struct type Note: this functions panics on error. For test usage only, not for production.
func MapFromJSON ¶
MapFromJSON is a test helper function that decodes recorded response body to a specific struct type Note: this functions panics on error. For test usage only, not for production.
Types ¶
type AuthOptions ¶
type TestContextMiddleware ¶
type TestContextMiddleware struct {
}
    func NewTestContextMiddleware ¶
func NewTestContextMiddleware() *TestContextMiddleware
func (*TestContextMiddleware) Handler ¶
func (middleware *TestContextMiddleware) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc, ctx domain.IContext)
type TestMiddleware ¶
type TestMiddleware struct {
}
    func NewTestMiddleware ¶
func NewTestMiddleware() *TestMiddleware
func (*TestMiddleware) Handler ¶
func (middleware *TestMiddleware) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
type TestRequestBody ¶
type TestRequestBody struct {
	Value string
}
    type TestResource ¶
type TestResource struct {
	Renderer domain.IRenderer
	Options  *TestResourceOptions
	// contains filtered or unexported fields
}
    func NewTestResource ¶
func NewTestResource(ctx domain.IContext, r domain.IRenderer, options *TestResourceOptions) *TestResource
TestResource implements IResource
func (*TestResource) Context ¶
func (resource *TestResource) Context() domain.IContext
func (*TestResource) HandleAllACL ¶
func (*TestResource) HandleGetRoute ¶
func (resource *TestResource) HandleGetRoute(w http.ResponseWriter, req *http.Request)
func (*TestResource) HandlePostRoute ¶
func (resource *TestResource) HandlePostRoute(w http.ResponseWriter, req *http.Request)
func (*TestResource) Render ¶
func (resource *TestResource) Render(w http.ResponseWriter, req *http.Request, status int, v interface{})
func (*TestResource) Routes ¶
func (resource *TestResource) Routes() *domain.Routes
type TestResourceOptions ¶
type TestResourceOptions struct {
	NilRoutes bool
}
    type TestResponseBody ¶
type TestServer ¶
type TestServer struct {
	Options        *TestServerOptions
	Server         *server.Server
	Router         *server.Router
	TokenAuthority sessionsDomain.ITokenAuthority
	Database       domain.IDatabase
	Renderer       domain.IRenderer
}
    func NewTestServer ¶
func NewTestServer(options *TestServerOptions) *TestServer
func (*TestServer) AddMiddlewares ¶
func (ts *TestServer) AddMiddlewares(middlewares ...interface{})
func (*TestServer) AddResources ¶
func (ts *TestServer) AddResources(resources ...domain.IResource)
func (*TestServer) Request ¶
func (ts *TestServer) Request(method string, urlStr string, body interface{}, targetResponse interface{}, authOptions *AuthOptions) *httptest.ResponseRecorder
func (*TestServer) Run ¶
func (ts *TestServer) Run()
type TestServerOptions ¶
 Click to show internal directories. 
   Click to hide internal directories.