-
Notifications
You must be signed in to change notification settings - Fork 0
/
Schema_test.go
46 lines (36 loc) · 927 Bytes
/
Schema_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
package aspace
import (
"flag"
goaspacetest "github.com/nyudlts/go-aspace/goaspace_testing"
"testing"
)
func TestSchemas(t *testing.T) {
flag.Parse()
client, err := NewClient(goaspacetest.Config, goaspacetest.Environment, 20)
if err != nil {
t.Error(err)
}
var randomSchema string
t.Run("Test Getting Schema List", func(t *testing.T) {
schemas, err := client.GetSchemas()
if err != nil {
t.Error(err)
}
if len(schemas) <= 0 {
t.Error("Received a zero length list of schemas")
}
t.Log("Successfully got a list of schemas")
keys := make([]string, 0, len(schemas))
for k, _ := range schemas {
keys = append(keys, k)
}
randomSchema = keys[rGen.Intn(len(keys))]
})
t.Run("Test Getting A Schema", func(t *testing.T) {
schema, err := client.GetSchema(randomSchema)
if err != nil {
t.Error(err)
}
t.Logf("Successfully got schema for %s: %v\n", randomSchema, schema)
})
}