-
Notifications
You must be signed in to change notification settings - Fork 0
/
TopContainers_test.go
70 lines (57 loc) · 1.61 KB
/
TopContainers_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package aspace
import (
"flag"
"testing"
goaspacetest "github.com/nyudlts/go-aspace/goaspace_testing"
)
var topContainerID int
var repositoryID int
var resourceID int
func TestTopContainers(t *testing.T) {
flag.Parse()
client, err := NewClient(goaspacetest.Config, goaspacetest.Environment, 20)
if err != nil {
t.Error(err)
}
repositoryID, _ = client.GetRandomRepository()
t.Log("Testing on repository", repositoryID)
//resourceIDs, _ := client.GetResourceIDs(repositoryID)
t.Log("Testing on Resource", resourceID)
t.Run("Test Get TopContainer IDS", func(t *testing.T) {
topContainers, err := client.GetTopContainerIDs(repositoryID)
if err != nil {
t.Error(err)
}
if len(topContainers) <= 0 {
t.Error("Array of less than 1 returned")
} else {
t.Log("returned", len(topContainers), "Top Containers")
}
topContainerID = topContainers[0]
})
t.Run("Test Get A Top Container", func(t *testing.T) {
topContainer, err := client.GetTopContainer(repositoryID, topContainerID)
if err != nil {
t.Error(err)
}
t.Log("Top Container", topContainer.URI, "serialized")
})
/*
t.Run("Test Get Top Container Ids for Resource", func(t *testing.T) {
topContainers, err := client.GetTopContainerIDsForResource(repositoryID, resourceIDs[0])
if err != nil {
t.Error(err)
}
fmt.Println(topContainers)
})
t.Run("Test Get Top Containers for Resource", func(t *testing.T) {
topContainers, err := client.GetTopContainersForResource(repositoryID, resourceIDs[0])
if err != nil {
t.Error(err)
}
for k, v := range topContainers {
fmt.Println(k, "->", v.Barcode)
}
})
*/
}