(t *testing.T, s Server)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 42 | func TestApplicationData(t *testing.T, s Server) { |
| 43 | key := ari.NewKey(ari.ApplicationKey, "1") |
no test coverage detected