grafana/pkg/services/encryption/encryption_test.go
Joan López de la Franca Beltran 28e27e1365
Encryption: De-duplicate encryption code with extensible service (#52472)
* Encryption: De-duplicate encryption code with extensible service

* Fix Wire injections

* Fix tests

* Register reload handler
2022-08-02 15:08:09 +02:00

23 lines
505 B
Go

package encryption
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_KeyToBytes(t *testing.T) {
t.Run("with regular secret", func(t *testing.T) {
key, err := KeyToBytes("secret", "salt")
require.NoError(t, err)
assert.Len(t, key, 32)
})
t.Run("with very long secret", func(t *testing.T) {
key, err := KeyToBytes("a very long secret key that is larger then 32bytes", "salt")
require.NoError(t, err)
assert.Len(t, key, 32)
})
}