2016-03-20 18:54:43 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2017-01-29 17:30:08 +00:00
|
|
|
"time"
|
2016-03-20 18:54:43 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReadConfig(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
2017-01-29 17:30:08 +00:00
|
|
|
config := ReadConfigFile("../config_example.toml")
|
2016-03-20 18:54:43 +00:00
|
|
|
assert.NotNil(config)
|
2017-01-29 17:30:08 +00:00
|
|
|
|
|
|
|
assert.True(config.Respondd.Enable)
|
|
|
|
assert.Equal("eth0", config.Respondd.Interface)
|
|
|
|
assert.Equal(time.Minute, config.Respondd.CollectInterval.Duration)
|
|
|
|
|
|
|
|
assert.Equal(2, config.Nodes.NodesVersion)
|
2017-01-29 19:40:46 +00:00
|
|
|
assert.Equal("/var/www/html/meshviewer/data/nodes.json", config.Nodes.NodesPath)
|
2017-01-29 17:30:08 +00:00
|
|
|
assert.Equal(time.Hour*24*7, config.Nodes.PruneAfter.Duration)
|
2016-03-20 18:54:43 +00:00
|
|
|
}
|