forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template_test.go
36 lines (31 loc) · 892 Bytes
/
template_test.go
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
36
package vehicle
import (
"testing"
"github.com/evcc-io/evcc/util/templates"
"github.com/evcc-io/evcc/util/test"
)
var acceptable = []string{
"invalid plugin source: ...",
"missing mqtt broker configuration",
"received status code 404 (INVALID PARAMS)", // Nissan
"missing personID",
"401 Unauthorized",
"unexpected length",
"i/o timeout",
"no such host",
"network is unreachable",
"error connecting: Network Error",
"unexpected status: 401",
"missing credentials", // Tesla
"missing credentials id", // Tronity
"missing access and/or refresh token, use `evcc token` to create", // Tesla
}
func TestTemplates(t *testing.T) {
templates.TestClass(t, templates.Vehicle, func(t *testing.T, values map[string]any) {
t.Helper()
if _, err := NewFromConfig("template", values); err != nil && !test.Acceptable(err, acceptable) {
t.Log(values)
t.Error(err)
}
})
}