forked from cloudfoundry/go-cfclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstacks_test.go
More file actions
52 lines (44 loc) · 1.44 KB
/
stacks_test.go
File metadata and controls
52 lines (44 loc) · 1.44 KB
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
package cfclient
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestListStacks(t *testing.T) {
Convey("List Stacks", t, func() {
mocks := []MockRoute{
{"GET", "/v2/stacks", []string{listStacksPayloadPage1}, "", 200, "", nil},
{"GET", "/v2/stacks_page_2", []string{listStacksPayloadPage2}, "", 200, "", nil},
}
setupMultiple(mocks, t)
defer teardown()
c := &Config{
ApiAddress: server.URL,
Token: "foobar",
}
client, err := NewClient(c)
So(err, ShouldBeNil)
stacks, err := client.ListStacks()
So(err, ShouldBeNil)
So(len(stacks), ShouldEqual, 2)
So(stacks[0].Guid, ShouldEqual, "67e019a3-322a-407a-96e0-178e95bd0e55")
So(stacks[0].Name, ShouldEqual, "cflinuxfs2")
So(stacks[0].Description, ShouldEqual, "Cloud Foundry Linux-based filesystem")
})
}
func TestGetStackByGuid(t *testing.T) {
Convey("Get Stack By Guid", t, func() {
setup(MockRoute{"GET", "/v2/stacks/a9be2e10-0164-401d-94e0-88455d614844", []string{stackByGuidPayload}, "", 200, "", nil}, t)
defer teardown()
c := &Config{
ApiAddress: server.URL,
Token: "foobar",
}
client, err := NewClient(c)
So(err, ShouldBeNil)
stack, err := client.GetStackByGuid("a9be2e10-0164-401d-94e0-88455d614844")
So(err, ShouldBeNil)
So(stack.Guid, ShouldEqual, "a9be2e10-0164-401d-94e0-88455d614844")
So(stack.Name, ShouldEqual, "windows2012R2")
So(stack.Description, ShouldEqual, "Experimental Windows runtime")
})
}