1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package storage
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func TestNewSQLiteProvider(t *testing.T) {
dir := t.TempDir()
testCases := []struct {
name string
have *schema.Configuration
}{
{
"ShouldHandleBasic",
&schema.Configuration{
Storage: schema.Storage{
Local: &schema.StorageLocal{
Path: filepath.Join(dir, "sqlite1.db"),
},
},
},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
assert.NotNil(t, NewSQLiteProvider(tc.have))
})
}
}
func TestSQLiteRegisteredFuncs(t *testing.T) {
output := sqlite3BLOBToTEXTBase64([]byte("example"))
assert.Equal(t, "ZXhhbXBsZQ==", output)
decoded, err := sqlite3TEXTBase64ToBLOB("ZXhhbXBsZQ==")
assert.NoError(t, err)
assert.Equal(t, []byte("example"), decoded)
}
|