mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 08:27:08 +08:00
31 lines
654 B
Go
31 lines
654 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/datarhei/core/v16/config/store"
|
|
"github.com/datarhei/core/v16/io/fs"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestImport(t *testing.T) {
|
|
memfs, err := fs.NewMemFilesystem(fs.MemConfig{})
|
|
require.NoError(t, err)
|
|
|
|
memfs.WriteFileReader("/mime.types", strings.NewReader("foobar"))
|
|
memfs.WriteFileReader("/bin/ffmpeg", strings.NewReader("foobar"))
|
|
|
|
configstore, err := store.NewJSON(memfs, "/config.json", nil)
|
|
require.NoError(t, err)
|
|
|
|
cfg := configstore.Get()
|
|
|
|
err = configstore.Set(cfg)
|
|
require.NoError(t, err)
|
|
|
|
err = doImport(nil, memfs, configstore)
|
|
require.NoError(t, err)
|
|
}
|