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

Function TestDeviceDelete

internal/integration/device.go:45–69  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

43}
44
45func TestDeviceDelete(t *testing.T, s Server) {
46 key := ari.NewKey(ari.DeviceStateKey, "d1")
47
48 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
49 m.DeviceState.On("Delete", key).Return(nil)
50
51 err := cl.DeviceState().Delete(key)
52 if err != nil {
53 t.Errorf("Error in remote device state Delete call: %s", err)
54 }
55
56 m.DeviceState.AssertCalled(t, "Delete", key)
57 })
58
59 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
60 m.DeviceState.On("Delete", key).Return(errors.New("err"))
61
62 err := cl.DeviceState().Delete(key)
63 if err == nil {
64 t.Errorf("Expected error in remote device state Delete call: %s", err)
65 }
66
67 m.DeviceState.AssertCalled(t, "Delete", key)
68 })
69}
70
71func TestDeviceUpdate(t *testing.T, s Server) {
72 key := ari.NewKey(ari.DeviceStateKey, "d1")

Callers 2

TestDeviceDeleteFunction · 0.92
TestDeviceDeleteFunction · 0.92

Calls 4

runTestFunction · 0.85
DeviceStateMethod · 0.80
NewMethod · 0.80
DeleteMethod · 0.45

Tested by

no test coverage detected