-
Notifications
You must be signed in to change notification settings - Fork 0
/
climate_test.go
84 lines (81 loc) · 2.03 KB
/
climate_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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package tesla
import (
"net/http"
"reflect"
"testing"
)
func TestTeslaApi_Climate(t1 *testing.T) {
tests := []struct {
name string
ta *TeslaApi
}{
{
name: "Test climate panics",
ta: fakeApi,
},
}
for _, tt := range tests {
t1.Run(tt.name, func(t1 *testing.T) {
_, _ = tt.ta.ClimateAutoAcStart()
_, _ = tt.ta.ClimateAutoAcStop()
_, _ = tt.ta.ClimateState()
_, _ = tt.ta.SetClimatePreConditionMax(true)
_, _ = tt.ta.SetClimateTemp(23.5, 23.5)
_, _ = tt.ta.SetSeatHeater(SeatFrontLeft, 3)
_, _ = tt.ta.SetSteeringHeater(true)
_, _ = tt.ta.SetCabinOverheatProtectionTemp(40)
})
}
}
func TestTeslaApi_SetCabinOverheatProtectionTemp(t1 *testing.T) {
type fields struct {
AuthReq AuthReq
client *http.Client
cookies []*http.Cookie
activeVehicle Vehicle
activeVehicleData VehicleData
accessToken string
refreshToken string
renewingToken bool
}
type args struct {
temp int
}
tests := []struct {
name string
fields fields
args args
wantCmdRes *CommandsRes
wantErr bool
}{
{
name: "Test set cabin overheat protection temp range",
wantErr: true,
args: args{
temp: 0,
},
},
}
for _, tt := range tests {
t1.Run(tt.name, func(t1 *testing.T) {
t := &TeslaApi{
AuthReq: tt.fields.AuthReq,
client: tt.fields.client,
cookies: tt.fields.cookies,
activeVehicle: tt.fields.activeVehicle,
activeVehicleData: tt.fields.activeVehicleData,
accessToken: tt.fields.accessToken,
refreshToken: tt.fields.refreshToken,
renewingToken: tt.fields.renewingToken,
}
gotCmdRes, err := t.SetCabinOverheatProtectionTemp(tt.args.temp)
if (err != nil) != tt.wantErr {
t1.Errorf("SetCabinOverheatProtectionTemp() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(gotCmdRes, tt.wantCmdRes) {
t1.Errorf("SetCabinOverheatProtectionTemp() gotCmdRes = %v, want %v", gotCmdRes, tt.wantCmdRes)
}
})
}
}