mock

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2017 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AryaStark *models.User

AryaStark is a mocked user

View Source
var DemoTenant *models.Tenant

DemoTenant is a mocked tenant

View Source
var JonSnow *models.User

JonSnow is a mocked user

View Source
var OrangeTenant *models.Tenant

OrangeTenant is a mocked tenant

Functions

This section is empty.

Types

type OAuthService added in v0.5.0

type OAuthService struct{}

OAuthService implements a mocked OAuthService

func (*OAuthService) GetAuthURL added in v0.5.0

func (p *OAuthService) GetAuthURL(authEndpoint string, provider string, redirect string) string

GetAuthURL returns authentication url for given provider

func (*OAuthService) GetProfile added in v0.5.0

func (p *OAuthService) GetProfile(authEndpoint string, provider string, code string) (*oauth.UserProfile, error)

GetProfile returns user profile based on provider and code

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a HTTP server wrapper for testing purpose

func NewServer

func NewServer() (*Server, *app.Services)

NewServer creates a new server and services for HTTP testing

func NewSingleTenantServer

func NewSingleTenantServer() (*Server, *app.Services)

NewSingleTenantServer creates a new multitenant test server

func (*Server) AddCookie added in v0.5.0

func (s *Server) AddCookie(name string, value string) *Server

AddCookie add key-value to current context cookies

func (*Server) AddHeader added in v0.5.0

func (s *Server) AddHeader(name string, value string) *Server

AddHeader add key-value to current context headers

func (*Server) AsUser added in v0.5.0

func (s *Server) AsUser(user *models.User) *Server

AsUser set current context user

func (*Server) Execute

func (s *Server) Execute(handler web.HandlerFunc) (int, *httptest.ResponseRecorder)

Execute given handler and return response

func (*Server) ExecuteAsJSON

func (s *Server) ExecuteAsJSON(handler web.HandlerFunc) (int, *jsonq.JsonQuery)

ExecuteAsJSON given handler and return json response

func (*Server) ExecutePost

func (s *Server) ExecutePost(handler web.HandlerFunc, body string) (int, *httptest.ResponseRecorder)

ExecutePost executes given handler as POST and return response

func (*Server) OnTenant added in v0.5.0

func (s *Server) OnTenant(tenant *models.Tenant) *Server

OnTenant set current context tenant

func (*Server) Use

func (s *Server) Use(middleware web.MiddlewareFunc)

Use adds a new middleware to pipeline

func (*Server) WithParam added in v0.5.0

func (s *Server) WithParam(name string, value interface{}) *Server

WithParam set current context params

func (*Server) WithParams added in v0.5.0

func (s *Server) WithParams(params web.Map) *Server

WithParams set current context params

func (*Server) WithURL added in v0.5.0

func (s *Server) WithURL(fullURL string) *Server

WithURL set current context Request URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL