(t *testing.T, s Server)
| 69 | } |
| 70 | |
| 71 | func TestDeviceUpdate(t *testing.T, s Server) { |
| 72 | key := ari.NewKey(ari.DeviceStateKey, "d1") |
| 73 | |
| 74 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 75 | m.DeviceState.On("Update", key, "st1").Return(nil) |
| 76 | |
| 77 | err := cl.DeviceState().Update(key, "st1") |
| 78 | if err != nil { |
| 79 | t.Errorf("Error in remote device state Update call: %s", err) |
| 80 | } |
| 81 | |
| 82 | m.DeviceState.AssertCalled(t, "Update", key, "st1") |
| 83 | }) |
| 84 | |
| 85 | runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 86 | m.DeviceState.On("Update", key, "st1").Return(errors.New("err")) |
| 87 | |
| 88 | err := cl.DeviceState().Update(key, "st1") |
| 89 | if err == nil { |
| 90 | t.Errorf("Expected error in remote device state Update call: %s", err) |
| 91 | } |
| 92 | |
| 93 | m.DeviceState.AssertCalled(t, "Update", key, "st1") |
| 94 | }) |
| 95 | } |
| 96 | |
| 97 | func TestDeviceList(t *testing.T, s Server) { |
| 98 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
no test coverage detected