mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-02-01 18:20:17 +01:00
feat: added modules
This commit is contained in:
20
core/utils/encrypt_test.go
Normal file
20
core/utils/encrypt_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEncryptAesPassword(t *testing.T) {
|
||||
plainText := "crawlab"
|
||||
encryptedText, err := EncryptAES(plainText)
|
||||
require.Nil(t, err)
|
||||
decryptedText, err := DecryptAES(encryptedText)
|
||||
require.Nil(t, err)
|
||||
fmt.Println(fmt.Sprintf("plainText: %s", plainText))
|
||||
fmt.Println(fmt.Sprintf("encryptedText: %s", encryptedText))
|
||||
fmt.Println(fmt.Sprintf("decryptedText: %s", decryptedText))
|
||||
require.Equal(t, decryptedText, plainText)
|
||||
require.NotEqual(t, decryptedText, encryptedText)
|
||||
}
|
||||
Reference in New Issue
Block a user