-
-
Notifications
You must be signed in to change notification settings - Fork 807
/
Copy pathtemplate_test.go
41 lines (36 loc) · 1.04 KB
/
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
37
38
39
40
41
package vehicle
import (
"context"
"testing"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util/templates"
"github.com/evcc-io/evcc/util/test"
)
var acceptable = []string{
api.ErrMissingCredentials.Error(),
api.ErrMissingToken.Error(),
"missing client id",
"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",
"discussions/17501", // Tesla
"login failed: code not found", // Polestar
"empty instance type- check for missing usage", // Merces
}
func TestTemplates(t *testing.T) {
templates.TestClass(t, templates.Vehicle, func(t *testing.T, values map[string]any) {
t.Helper()
if _, err := NewFromConfig(context.TODO(), "template", values); err != nil && !test.Acceptable(err, acceptable) {
t.Log(values)
t.Error(err)
}
})
}