2020-07-13 17:37:43 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfig_PublicConfig(t *testing.T) {
|
2020-07-13 20:25:47 +02:00
|
|
|
config := TestConfig()
|
2020-07-13 17:37:43 +02:00
|
|
|
result := config.PublicConfig()
|
|
|
|
assert.IsType(t, ClientConfig{}, result)
|
|
|
|
assert.Equal(t, true, result.Public)
|
2020-07-13 18:05:10 +02:00
|
|
|
c2 := NewTestErrorConfig()
|
|
|
|
result2 := c2.PublicConfig()
|
|
|
|
assert.IsType(t, ClientConfig{}, result2)
|
|
|
|
assert.Equal(t, false, result2.Public)
|
2020-07-13 17:37:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_GuestConfig(t *testing.T) {
|
2020-07-13 20:25:47 +02:00
|
|
|
config := TestConfig()
|
2020-07-13 17:37:43 +02:00
|
|
|
result := config.GuestConfig()
|
|
|
|
assert.IsType(t, ClientConfig{}, result)
|
|
|
|
assert.Equal(t, true, result.Public)
|
2020-07-13 20:25:47 +02:00
|
|
|
assert.Equal(t, false, result.Experimental)
|
|
|
|
assert.Equal(t, true, result.ReadOnly)
|
2020-07-13 17:37:43 +02:00
|
|
|
}
|
2020-07-13 19:25:27 +02:00
|
|
|
|
|
|
|
func TestConfig_Flags(t *testing.T) {
|
2020-07-13 20:25:47 +02:00
|
|
|
config := TestConfig()
|
2020-07-13 19:25:27 +02:00
|
|
|
config.params.Experimental = true
|
|
|
|
config.params.ReadOnly = true
|
|
|
|
|
|
|
|
result := config.Flags()
|
|
|
|
assert.Equal(t, []string{"public", "debug", "experimental", "readonly", "settings"}, result)
|
2020-07-13 20:25:47 +02:00
|
|
|
|
|
|
|
config.params.Experimental = false
|
|
|
|
config.params.ReadOnly = false
|
2020-07-13 19:25:27 +02:00
|
|
|
}
|