当前位置: 首页>>代码示例>>Golang>>正文


Golang forest.New函数代码示例

本文整理汇总了Golang中github.com/ursiform/forest.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestAuthenticateFailure

func TestAuthenticateFailure(t *testing.T) {
	method := "GET"
	path := root + "/authenticate/failure"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusUnauthorized, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例2: TestSessionGetSuccessCreateEmpty

func TestSessionGetSuccessCreateEmpty(t *testing.T) {
	method := "GET"
	path := root + "/session-get"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例3: TestMethodNotAllowed

func TestMethodNotAllowed(t *testing.T) {
	method := "OPTIONS"
	path := root
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusMethodNotAllowed, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例4: TestServerError

func TestServerError(t *testing.T) {
	method := "GET"
	path := root + "/server-error"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusInternalServerError, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例5: TestNotFound

func TestNotFound(t *testing.T) {
	method := "GET"
	path := root + "/not-found"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusNotFound, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例6: TestCSRFFailureBodyNil

func TestCSRFFailureBodyNil(t *testing.T) {
	method := "GET"
	path := root + "/csrf"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusBadRequest, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例7: TestAuthenticateSuccess

func TestAuthenticateSuccess(t *testing.T) {
	method := "GET"
	path := root + "/authenticate/success"
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:9,代码来源:wares-test_test.go

示例8: TestSessionSetUpdateError

func TestSessionSetUpdateError(t *testing.T) {
	method := "GET"
	path := root + "/session-set"
	auth := sessionIDWithUpdateError
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{auth: auth, method: method, path: path}
	want := &wanted{code: http.StatusInternalServerError, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例9: TestSessionSetSuccess

func TestSessionSetSuccess(t *testing.T) {
	method := "GET"
	path := root + "/session-set"
	auth := sessionIDExistent
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{auth: auth, method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例10: TestSessionGetSuccessCreateErrorWithDeleteError

func TestSessionGetSuccessCreateErrorWithDeleteError(t *testing.T) {
	method := "GET"
	path := root + "/session-get/create-error"
	auth := sessionIDWithDeleteError
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{auth: auth, method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例11: TestCSRFSuccess

func TestCSRFSuccess(t *testing.T) {
	method := "GET"
	path := root + "/csrf"
	body := []byte(fmt.Sprintf("{\"sessionid\": \"%s\"}", sessionIDExistent))
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{body: body, method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例12: TestCSRFFailureWrongSessionID

func TestCSRFFailureWrongSessionID(t *testing.T) {
	method := "GET"
	path := root + "/csrf"
	body := []byte(fmt.Sprintf("{\"sessionid\": \"WRONG-SESSION-ID\"}"))
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{body: body, method: method, path: path}
	want := &wanted{code: http.StatusBadRequest, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例13: TestBodyParserSuccess

func TestBodyParserSuccess(t *testing.T) {
	method := "POST"
	path := root + "/body-parser/success"
	body := []byte(arbitraryJSON)
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{body: body, method: method, path: path}
	want := &wanted{code: http.StatusOK, success: true}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例14: TestBodyParserFailureNoInit

func TestBodyParserFailureNoInit(t *testing.T) {
	method := "POST"
	path := root + "/body-parser/failure/no-init"
	body := []byte(arbitraryJSON)
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{body: body, method: method, path: path}
	want := &wanted{code: http.StatusInternalServerError, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go

示例15: TestBodyParserFailureBadInput

func TestBodyParserFailureBadInput(t *testing.T) {
	method := "POST"
	path := root + "/body-parser/success"
	body := []byte("{BAD JSON}")
	app := forest.New("")
	app.RegisterRoute(root, newRouter(app))
	params := &requested{body: body, method: method, path: path}
	want := &wanted{code: http.StatusBadRequest, success: false}
	makeRequest(t, app, params, want)
}
开发者ID:ursiform,项目名称:forest-wares,代码行数:10,代码来源:wares-test_test.go


注:本文中的github.com/ursiform/forest.New函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。