(t *testing.T, s Server)
| 41 | } |
| 42 | |
| 43 | func 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 | |
| 76 | func TestEndpointData(t *testing.T, s Server) { |
| 77 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
no test coverage detected