forked from stmcginnis/gofish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththermalequipment_test.go
43 lines (37 loc) · 1.04 KB
/
thermalequipment_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
//
// SPDX-License-Identifier: BSD-3-Clause
//
package redfish
import (
"encoding/json"
"strings"
"testing"
)
var thermalEquipmentBody = `{
"@odata.type": "#ThermalEquipment.v1_1_1.ThermalEquipment",
"Id": "ThermalEquipment",
"Name": "Cooling Equipment",
"Status": {
"State": "Enabled",
"HealthRollup": "OK"
},
"CDUs": {
"@odata.id": "/redfish/v1/ThermalEquipment/CDUs"
},
"CoolingLoops": {
"@odata.id": "/redfish/v1/ThermalEquipment/CoolingLoops"
},
"@odata.id": "/redfish/v1/ThermalEquipment"
}`
// TestThermalEquipment tests the parsing of ThermalEquipment objects.
func TestThermalEquipment(t *testing.T) {
var result ThermalEquipment
err := json.NewDecoder(strings.NewReader(thermalEquipmentBody)).Decode(&result)
if err != nil {
t.Errorf("Error decoding JSON: %s", err)
}
assertEquals(t, "ThermalEquipment", result.ID)
assertEquals(t, "Cooling Equipment", result.Name)
assertEquals(t, "/redfish/v1/ThermalEquipment/CDUs", result.cdus)
assertEquals(t, "/redfish/v1/ThermalEquipment/CoolingLoops", result.coolingLoops)
}