MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestAllowCookieInfo_Encode

Function TestAllowCookieInfo_Encode

internal/waf/allow_cookie_info_test.go:13–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestAllowCookieInfo_Encode(t *testing.T) {
14 var a = assert.NewAssertion(t)
15
16 var info = &waf.AllowCookieInfo{
17 SetId: 123,
18 ExpiresAt: fasttime.Now().Unix(),
19 }
20 data, err := info.Encode()
21 if err != nil {
22 t.Fatal(err)
23 }
24 t.Log("encrypted: ["+types.String(len(data))+"]", data)
25
26 var info2 = &waf.AllowCookieInfo{}
27 err = info2.Decode(data)
28 if err != nil {
29 t.Fatal(err)
30 }
31
32 t.Logf("%+v", info2)
33 a.IsTrue(info.SetId == info2.SetId)
34 a.IsTrue(info.ExpiresAt == info2.ExpiresAt)
35}

Callers

nothing calls this directly

Calls 6

NowFunction · 0.92
UnixMethod · 0.80
LogMethod · 0.80
EncodeMethod · 0.65
DecodeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected