forked from cathiele/evcc-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplates_test.go
More file actions
35 lines (29 loc) · 770 Bytes
/
templates_test.go
File metadata and controls
35 lines (29 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"testing"
"github.com/andig/evcc-config/registry"
_ "github.com/andig/evcc-config/templates"
"github.com/andig/evcc/charger"
"github.com/andig/evcc/meter"
"github.com/andig/evcc/util"
"github.com/andig/evcc/vehicle"
"gopkg.in/yaml.v2"
)
func TestTemplates(t *testing.T) {
log := util.NewLogger("foo")
// log.SetLogThreshold(jww.Th)
for _, template := range registry.Registry {
var conf map[string]interface{}
if err := yaml.Unmarshal([]byte(template.Sample), &conf); err != nil {
panic(err)
}
switch template.Class {
case "meter":
meter.NewConfigurableFromConfig(log, conf)
case "charger":
charger.NewConfigurableFromConfig(log, conf)
case "vehicle":
vehicle.NewConfigurableFromConfig(log, conf)
}
}
}