forked from stmcginnis/gofish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectionmethod_test.go
43 lines (37 loc) · 1.18 KB
/
connectionmethod_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 connectionMethodBody = `{
"@odata.type": "#ConnectionMethod.v1_1_0.ConnectionMethod",
"Id": "ConnectionMethod1",
"Name": "ConnectionMethod One",
"ConnectionMethodType": "Redfish",
"ConnectionMethodVariant": "Contoso",
"Links": {
"AggregationSources": [
{
"@odata.id": "/redfish/v1/AggregationService/AggregationSources/AggregationSource1"
}
]
},
"@odata.id": "/redfish/v1/AggregationService/ConnectionMethods/ConnectionMethod1"
}`
// TestConnectionMethod tests the parsing of ConnectionMethod objects.
func TestConnectionMethod(t *testing.T) {
var result ConnectionMethod
err := json.NewDecoder(strings.NewReader(connectionMethodBody)).Decode(&result)
if err != nil {
t.Errorf("Error decoding JSON: %s", err)
}
assertEquals(t, "ConnectionMethod1", result.ID)
assertEquals(t, "ConnectionMethod One", result.Name)
assertEquals(t, "Redfish", string(result.ConnectionMethodType))
assertEquals(t, "Contoso", result.ConnectionMethodVariant)
assertEquals(t, "/redfish/v1/AggregationService/AggregationSources/AggregationSource1", result.aggregationSources[0])
}