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

Function TestEndpointListByTech

internal/integration/endpoint.go:43–74  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

41}
42
43func TestEndpointListByTech(t *testing.T, s Server) {
44 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
45 h1 := ari.NewEndpointKey("h1", "1")
46 h2 := ari.NewEndpointKey("h1", "2")
47
48 m.Endpoint.On("ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""}).Return([]*ari.Key{h1, h2}, nil)
49
50 list, err := cl.Endpoint().ListByTech("tech", nil)
51 if err != nil {
52 t.Errorf("Error in remote Endpoint List call: %s", err)
53 }
54 if len(list) != 2 {
55 t.Errorf("Expected list of length 2, got %d", len(list))
56 }
57
58 m.Endpoint.AssertCalled(t, "ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""})
59 })
60
61 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
62 m.Endpoint.On("ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""}).Return([]*ari.Key{}, errors.New("error"))
63
64 list, err := cl.Endpoint().ListByTech("tech", nil)
65 if err == nil {
66 t.Errorf("Expected error in remote Endpoint List call")
67 }
68 if len(list) != 0 {
69 t.Errorf("Expected list of length 0, got %d", len(list))
70 }
71
72 m.Endpoint.AssertCalled(t, "ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""})
73 })
74}
75
76func TestEndpointData(t *testing.T, s Server) {
77 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {

Callers 2

TestEndpointListByTechFunction · 0.92
TestEndpointListByTechFunction · 0.92

Calls 4

runTestFunction · 0.85
ListByTechMethod · 0.80
EndpointMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected