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

Function TestConfigDelete

internal/integration/config.go:76–106  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

74}
75
76func TestConfigDelete(t *testing.T, s Server) {
77 key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1"))
78
79 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
80 cfg := arimocks.Config{}
81 m.Asterisk.On("Config").Return(&cfg)
82 cfg.On("Delete", key).Return(nil)
83
84 err := cl.Asterisk().Config().Delete(key)
85 if err != nil {
86 t.Errorf("Unexpected error in remove config delete call: %s", err)
87 }
88
89 m.Asterisk.AssertCalled(t, "Config")
90 cfg.AssertCalled(t, "Delete", key)
91 })
92
93 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
94 cfg := arimocks.Config{}
95 m.Asterisk.On("Config").Return(&cfg)
96 cfg.On("Delete", key).Return(errors.New("error"))
97
98 err := cl.Asterisk().Config().Delete(key)
99 if err == nil {
100 t.Errorf("Expected error in remove config delete call")
101 }
102
103 m.Asterisk.AssertCalled(t, "Config")
104 cfg.AssertCalled(t, "Delete", key)
105 })
106}
107
108func TestConfigUpdate(t *testing.T, s Server) {
109 key := ari.NewKey("config", ari.ConfigID("c1", "o1", "id1"))

Callers 2

TestConfigDeleteFunction · 0.92
TestConfigDeleteFunction · 0.92

Calls 5

runTestFunction · 0.85
ConfigMethod · 0.80
AsteriskMethod · 0.80
NewMethod · 0.80
DeleteMethod · 0.45

Tested by

no test coverage detected