Fix vehicle tests

This commit is contained in:
andig 2021-02-05 09:10:12 +01:00
parent 810a60a4c3
commit 9120014728
2 changed files with 6 additions and 2 deletions

View file

@ -18,8 +18,8 @@ func TestVehicles(t *testing.T) {
"Missing required parameter", // Renault
"error connecting: Network Error",
"unexpected status: 401",
"could not obtain token", // Porsche
"login failed: 400 Bad Request", // Tesla
"could not obtain token", // Porsche
"missing credentials", // Tesla
}
for _, tmpl := range test.ConfigTemplates("vehicle") {

View file

@ -50,6 +50,10 @@ func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
return nil, err
}
if cc.User == "" && cc.Tokens.Access == "" {
return nil, errors.New("missing credentials")
}
v := &Tesla{
embed: &embed{cc.Title, cc.Capacity},
}