MCPcopy Create free account
hub / github.com/CyCoreSystems/ari-proxy / TestApplicationList

Function TestApplicationList

internal/integration/application.go:11–40  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

9)
10
11func TestApplicationList(t *testing.T, s Server) {
12 runTest("emptyList", t, s, func(t *testing.T, m *mock, cl ari.Client) {
13 m.Application.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, nil)
14
15 if _, err := cl.Application().List(nil); err != nil {
16 t.Errorf("Unexpected error in remote List call: %v", err)
17 }
18 })
19
20 runTest("nonEmptyList", t, s, func(t *testing.T, m *mock, cl ari.Client) {
21 h1 := ari.NewKey(ari.ApplicationKey, "1")
22 h2 := ari.NewKey(ari.ApplicationKey, "2")
23 m.Application.On("List", (*ari.Key)(nil)).Return([]*ari.Key{h1, h2}, nil)
24
25 items, err := cl.Application().List(nil)
26 if err != nil {
27 t.Errorf("Unexpected error in remote List call: %v", err)
28 }
29 if len(items) != 2 {
30 t.Errorf("Expected items to be length 2, got %d", len(items))
31 } else {
32 if items[0].ID != "1" {
33 t.Errorf("Expected item 0 to be '1', got %s", items[0].ID)
34 }
35 if items[1].ID != "2" {
36 t.Errorf("Expected item 1 to be '2', got %s", items[1].ID)
37 }
38 }
39 })
40}
41
42func TestApplicationData(t *testing.T, s Server) {
43 key := ari.NewKey(ari.ApplicationKey, "1")

Callers 2

TestApplicationListFunction · 0.92
TestApplicationListFunction · 0.92

Calls 3

runTestFunction · 0.85
ApplicationMethod · 0.80
ListMethod · 0.65

Tested by

no test coverage detected