Upstream sync
This commit is contained in:
22
shared/encryption_test.go
Normal file
22
shared/encryption_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEncryptionClient(t *testing.T) {
|
||||
|
||||
client := encryptionClient{Secret: `abc&1*~#^2^#s0^=)^^7%b34`}
|
||||
|
||||
t.Run("encrypt/ decyrpt works", func(t *testing.T) {
|
||||
text := "sample text to test encryption"
|
||||
encodedText, err := client.Encrypt(text)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, text, encodedText)
|
||||
decodedText, err := client.Decrypt(encodedText)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, text, decodedText)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user