mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
21 lines
416 B
Go
21 lines
416 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"strings"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestCpeEncryption(t *testing.T) {
|
||
|
secret := []byte("testKey!")
|
||
|
payload := []byte(strings.Repeat("testString", 100))
|
||
|
|
||
|
encrypted, err := encrypt(secret, payload)
|
||
|
assert.NoError(t, err)
|
||
|
assert.NotNil(t, encrypted)
|
||
|
|
||
|
decrypted, err := decrypt(secret, encrypted)
|
||
|
assert.NoError(t, err)
|
||
|
assert.Equal(t, decrypted, payload)
|
||
|
}
|