MCPcopy
hub / github.com/apache/devlake / TestEncodeAndDecode

Function TestEncodeAndDecode

backend/core/plugin/plugin_utils_test.go:26–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestEncodeAndDecode(t *testing.T) {
27 TestStr := "The string for testing"
28 var err error
29
30 var TestEncode string
31 var TestDecode string
32
33 encryptionSecret, _ := RandomEncryptionSecret()
34 // encryption test
35 TestEncode, err = Encrypt(encryptionSecret, TestStr)
36 assert.Empty(t, err)
37
38 // decrypt test
39 TestDecode, err = Decrypt(encryptionSecret, TestEncode)
40 assert.Empty(t, err)
41
42 // Verify decryption result
43 assert.Equal(t, string(TestDecode), TestStr)
44}
45
46func TestEncode(t *testing.T) {
47 encryptionSecret, _ := RandomEncryptionSecret()

Callers

nothing calls this directly

Calls 3

RandomEncryptionSecretFunction · 0.85
EncryptFunction · 0.85
DecryptFunction · 0.85

Tested by

no test coverage detected