1
0
Fork 0
mirror of https://github.com/shouptech/tempgopher.git synced 2026-02-03 08:39:43 +00:00
tempgopher/config_test.go
2018-09-28 15:05:54 -06:00

30 lines
607 B
Go

package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_LoadConfig(t *testing.T) {
testSensor := Sensor{
ID: "28-000008083108",
Alias: "fermenter",
HighTemp: 8,
LowTemp: 4,
HeatGPIO: 5,
HeatPullup: true,
HeatMinutes: 5,
CoolGPIO: 17,
CoolPullup: false,
CoolMinutes: 10}
testConfig := Config{Sensors: []Sensor{testSensor}}
loadedConfig, err := LoadConfig("test_config.yml")
assert.Equal(t, nil, err)
assert.Equal(t, &testConfig, loadedConfig)
_, err = LoadConfig("thisfiledoesnotexist")
assert.NotEqual(t, nil, err)
}