MCPcopy Index your code
hub / github.com/kataras/iris / TestSessionsEncodeDecode

Function TestSessionsEncodeDecode

_examples/sessions/securecookie/main_test.go:10–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestSessionsEncodeDecode(t *testing.T) {
11 app := newApp()
12 e := httptest.New(t, app, httptest.URL("http://example.com"))
13
14 es := e.GET("/set").Expect()
15 es.Status(iris.StatusOK)
16 es.Cookies().NotEmpty()
17 es.Body().IsEqual("All ok session set to: iris [isNew=true]")
18
19 e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: iris")
20 // delete and re-get
21 e.GET("/delete").Expect().Status(iris.StatusOK)
22 e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ")
23 // set, clear and re-get
24 e.GET("/set").Expect().Body().IsEqual("All ok session set to: iris [isNew=false]")
25 e.GET("/clear").Expect().Status(iris.StatusOK)
26 e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ")
27}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
URLMethod · 0.80
StatusMethod · 0.80
newAppFunction · 0.70
BodyMethod · 0.65
NotEmptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…