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

Function TestSimpleEncryptObject

internal/utils/encrypt_test.go:27–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestSimpleEncryptObject(t *testing.T) {
28 var a = assert.NewAssertion(t)
29
30 type Obj struct {
31 Name string `json:"name"`
32 Age int `json:"age"`
33 }
34
35 encoded, err := utils.SimpleEncryptObject(&Obj{Name: "lily", Age: 20})
36 if err != nil {
37 t.Fatal(err)
38 }
39
40 var obj = &Obj{}
41 err = utils.SimpleDecryptObjet(encoded, obj)
42 if err != nil {
43 t.Fatal(err)
44 }
45 t.Logf("%#v", obj)
46 a.IsTrue(obj.Name == "lily")
47 a.IsTrue(obj.Age == 20)
48}
49
50func TestSimpleEncrypt_Concurrent(t *testing.T) {
51 var wg = sync.WaitGroup{}

Callers

nothing calls this directly

Calls 2

SimpleEncryptObjectFunction · 0.92
SimpleDecryptObjetFunction · 0.92

Tested by

no test coverage detected