mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
21 lines
563 B
Go
21 lines
563 B
Go
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)
|
|
}
|