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

Function TestDeviceUpdate

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

Source from the content-addressed store, hash-verified

69}
70
71func 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
97func TestDeviceList(t *testing.T, s Server) {
98 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {

Callers 2

TestDeviceUpdateFunction · 0.92
TestDeviceUpdateFunction · 0.92

Calls 4

runTestFunction · 0.85
DeviceStateMethod · 0.80
NewMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected