forked from HewlettPackard/morpheus-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapps_test.go
More file actions
32 lines (27 loc) · 732 Bytes
/
apps_test.go
File metadata and controls
32 lines (27 loc) · 732 Bytes
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
package morpheus_test
import (
"testing"
"github.com/gomorpheus/morpheus-go-sdk"
)
func TestListApps(t *testing.T) {
client := getTestClient(t)
req := &morpheus.Request{}
resp, err := client.ListApps(req)
assertResponse(t, resp, err)
}
func TestGetApp(t *testing.T) {
client := getTestClient(t)
req := &morpheus.Request{}
resp, err := client.ListApps(req)
assertResponse(t, resp, err)
// parse JSON and fetch the first one by ID
result := resp.Result.(*morpheus.ListAppsResult)
recordCount := result.Meta.Total
t.Logf("Found %d Apps.", recordCount)
if recordCount != 0 {
// Get by ID
record := (*result.Apps)[0]
resp, err = client.GetApp(record.ID, &morpheus.Request{})
assertResponse(t, resp, err)
}
}