forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_instance_usage_summary_resource_test.go
54 lines (51 loc) · 1.46 KB
/
service_instance_usage_summary_resource_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
package resources_test
import (
"encoding/json"
. "code.cloudfoundry.org/cli/resources"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("service instance usage resource", func() {
DescribeTable(
"Unmarshaling",
func(serviceInstanceUsageSummaryList ServiceInstanceUsageSummaryList, serialized string) {
var parsed ServiceInstanceUsageSummaryList
Expect(json.Unmarshal([]byte(serialized), &parsed)).NotTo(HaveOccurred())
Expect(parsed).To(Equal(serviceInstanceUsageSummaryList))
},
Entry("space_guid", ServiceInstanceUsageSummaryList{UsageSummary: []ServiceInstanceUsageSummary{{SpaceGUID: "fake-space-guid"}}}, `{"usage_summary":[{"space": {"guid": "fake-space-guid"}}]}`),
Entry("bound_app_count", ServiceInstanceUsageSummaryList{UsageSummary: []ServiceInstanceUsageSummary{{BoundAppCount: 2}}}, `{"usage_summary":[{"bound_app_count": 2}]}`),
Entry(
"everything",
ServiceInstanceUsageSummaryList{
UsageSummary: []ServiceInstanceUsageSummary{
{
SpaceGUID: "fake-space-guid",
BoundAppCount: 4,
},
{
SpaceGUID: "other-fake-space-guid",
BoundAppCount: 3,
},
},
},
`{
"usage_summary": [
{
"space": {
"guid": "fake-space-guid"
},
"bound_app_count": 4
},
{
"space": {
"guid": "other-fake-space-guid"
},
"bound_app_count": 3
}
]
}`,
),
)
})