github.com/SAP/jenkins-library@v1.362.0/cmd/readPipelineEnv_test.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/stretchr/testify/assert"
     5  	"strings"
     6  	"testing"
     7  )
     8  
     9  func TestCpeEncryption(t *testing.T) {
    10  	secret := []byte("testKey!")
    11  	payload := []byte(strings.Repeat("testString", 100))
    12  
    13  	encrypted, err := encrypt(secret, payload)
    14  	assert.NoError(t, err)
    15  	assert.NotNil(t, encrypted)
    16  
    17  	decrypted, err := decrypt(secret, encrypted)
    18  	assert.NoError(t, err)
    19  	assert.Equal(t, decrypted, payload)
    20  }