-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agents_test.go
60 lines (49 loc) · 1.36 KB
/
Agents_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
package aspace
import (
"flag"
goaspacetest "github.com/nyudlts/go-aspace/goaspace_testing"
"testing"
)
func TestAgents(t *testing.T) {
flag.Parse()
client, err := NewClient(goaspacetest.Config, goaspacetest.Environment, 20)
if err != nil {
t.Error(err)
}
t.Run("Test a person agent", func(t *testing.T) {
agentId, err := client.GetRandomAgentID("people")
if err != nil {
t.Error(err)
}
agent, err := client.GetAgent("people", agentId)
if err != nil {
t.Error(err)
} else {
t.Logf("Successfully requested and serialized person agent %s: %s\n", agent.URI, agent.Names[0].SortName)
}
})
t.Run("Test a family agent", func(t *testing.T) {
agentId, err := client.GetRandomAgentID("families")
if err != nil {
t.Error(err)
}
agent, err := client.GetAgent("families", agentId)
if err != nil {
t.Error(err)
} else {
t.Logf("Successfully requested and serialized family agent %s: %s\n", agent.URI, agent.Names[0].SortName)
}
})
t.Run("Test a corporate entitiy agent", func(t *testing.T) {
agentId, err := client.GetRandomAgentID("corporate_entities")
if err != nil {
t.Error(err)
}
agent, err := client.GetAgent("corporate_entities", agentId)
if err != nil {
t.Error(err)
} else {
t.Logf("Successfully requested and serialized corporate entity agent %s: %s\n", agent.URI, agent.Names[0].SortName)
}
})
}