diff options
Diffstat (limited to 'internal/storage/sql_provider_backend_sqlite_test.go')
| -rw-r--r-- | internal/storage/sql_provider_backend_sqlite_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/internal/storage/sql_provider_backend_sqlite_test.go b/internal/storage/sql_provider_backend_sqlite_test.go new file mode 100644 index 000000000..a591d0bed --- /dev/null +++ b/internal/storage/sql_provider_backend_sqlite_test.go @@ -0,0 +1,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) +} |
