mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Migrate to koanf * Use temp logger for crashes before config is initialised * Remove snake case hacks * Add migration for config file keys * Add migration note for new migration * Renamed viper functions * Remove front-end viper workaround * Correctly default scan options
34 lines
985 B
Go
34 lines
985 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConfig_GetAllPluginConfiguration(t *testing.T) {
|
|
i := InitializeEmpty()
|
|
|
|
assert.Equal(t, i.GetAllPluginConfiguration(), map[string]map[string]interface{}{})
|
|
|
|
i.SetPluginConfiguration("plugin1", map[string]interface{}{"key1": "value1"})
|
|
|
|
assert.Equal(t, map[string]map[string]interface{}{
|
|
"plugin1": {"key1": "value1"},
|
|
}, i.GetAllPluginConfiguration())
|
|
|
|
i.SetPluginConfiguration("plugin2", map[string]interface{}{"key2": "value2"})
|
|
|
|
assert.Equal(t, map[string]map[string]interface{}{
|
|
"plugin1": {"key1": "value1"},
|
|
"plugin2": {"key2": "value2"},
|
|
}, i.GetAllPluginConfiguration())
|
|
|
|
// ensure SetPluginConfiguration overwrites existing configuration
|
|
i.SetPluginConfiguration("plugin2", map[string]interface{}{"key3": "value3"})
|
|
|
|
assert.Equal(t, map[string]map[string]interface{}{
|
|
"plugin1": {"key1": "value1"},
|
|
"plugin2": {"key3": "value3"},
|
|
}, i.GetAllPluginConfiguration())
|
|
}
|