mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-31 13:02:52 +09:00
Fix bug
This commit is contained in:
22
services/secrets/encryption_aes_test.go
Normal file
22
services/secrets/encryption_aes_test.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package secrets
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEncryptDecrypt(t *testing.T) {
|
||||
provider := NewAesEncryptionProvider()
|
||||
key := []byte("1111111111111111")
|
||||
pri := "vvvvvvv"
|
||||
enc, err := provider.EncryptString(pri, key)
|
||||
assert.NoError(t, err)
|
||||
v, err := provider.DecryptString(enc, key)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, pri, v)
|
||||
}
|
Reference in New Issue
Block a user