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