forked from stmcginnis/gofish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlicenseservice_test.go
49 lines (44 loc) · 1.3 KB
/
licenseservice_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
//
// SPDX-License-Identifier: BSD-3-Clause
//
package redfish
import (
"encoding/json"
"strings"
"testing"
)
var licenseServiceBody = strings.NewReader(
`{
"@odata.context": "/redfish/v1/$metadata#LicenseService.LicenseService",
"@odata.id": "/redfish/v1/LicenseService",
"@odata.type": "#LicenseService.v1_1_0.LicenseService",
"Actions": {
"#LicenseService.Install": {
"[email protected]": [
"HTTP",
"HTTPS",
"NFS",
"CIFS"
],
"target": "/redfish/v1/LicenseService/Actions/LicenseService.Install"
}
},
"Description": "This resource represent a license service and the properties that affect the service itself.",
"Id": "LicenseService",
"Licenses": {
"@odata.id": "/redfish/v1/LicenseService/Licenses"
},
"Name": "LicenseService",
"ServiceEnabled": true
}`)
// TestLicenseService tests the parsing of LicenseService objects.
func TestLicenseService(t *testing.T) {
var result LicenseService
err := json.NewDecoder(licenseServiceBody).Decode(&result)
if err != nil {
t.Errorf("Error decoding JSON: %s", err)
}
assertEquals(t, "LicenseService", result.ID)
assertEquals(t, "/redfish/v1/LicenseService/Licenses", result.licenses)
assertEquals(t, "/redfish/v1/LicenseService/Actions/LicenseService.Install", result.installTarget)
}