mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
28e27e1365
* Encryption: De-duplicate encryption code with extensible service * Fix Wire injections * Fix tests * Register reload handler
23 lines
505 B
Go
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)
|
|
})
|
|
}
|