(t *testing.T, s Server)
| 8 | ) |
| 9 | |
| 10 | func TestEndpointList(t *testing.T, s Server) { |
| 11 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 12 | h1 := ari.NewEndpointKey("h1", "1") |
| 13 | h2 := ari.NewEndpointKey("h1", "2") |
| 14 | |
| 15 | m.Endpoint.On("List", (*ari.Key)(nil)).Return([]*ari.Key{h1, h2}, nil) |
| 16 | |
| 17 | list, err := cl.Endpoint().List(nil) |
| 18 | if err != nil { |
| 19 | t.Errorf("Error in remote Endpoint List call: %s", err) |
| 20 | } |
| 21 | if len(list) != 2 { |
| 22 | t.Errorf("Expected list of length 2, got %d", len(list)) |
| 23 | } |
| 24 | |
| 25 | m.Endpoint.AssertCalled(t, "List", (*ari.Key)(nil)) |
| 26 | }) |
| 27 | |
| 28 | runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 29 | m.Endpoint.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, errors.New("error")) |
| 30 | |
| 31 | list, err := cl.Endpoint().List(nil) |
| 32 | if err == nil { |
| 33 | t.Errorf("Expected error in remote Endpoint List call") |
| 34 | } |
| 35 | if len(list) != 0 { |
| 36 | t.Errorf("Expected list of length 0, got %d", len(list)) |
| 37 | } |
| 38 | |
| 39 | m.Endpoint.AssertCalled(t, "List", (*ari.Key)(nil)) |
| 40 | }) |
| 41 | } |
| 42 | |
| 43 | func TestEndpointListByTech(t *testing.T, s Server) { |
| 44 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
no test coverage detected