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

Function TestModulesReload

internal/integration/modules.go:67–94  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

65}
66
67func TestModulesReload(t *testing.T, s Server) {
68 key := ari.NewKey(ari.ModuleKey, "m1")
69
70 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
71 m.Modules.On("Reload", key).Return(nil)
72
73 if err := cl.Asterisk().Modules().Reload(key); err != nil {
74 t.Errorf("Unexpected error in module Reload: %s", err)
75 }
76
77 m.Shutdown()
78
79 m.Asterisk.AssertCalled(t, "Modules")
80 m.Modules.AssertCalled(t, "Reload", key)
81 })
82 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
83 m.Modules.On("Reload", key).Return(errors.New("error"))
84
85 if err := cl.Asterisk().Modules().Reload(key); err == nil {
86 t.Errorf("Expected error in module Reload")
87 }
88
89 m.Shutdown()
90
91 m.Asterisk.AssertCalled(t, "Modules")
92 m.Modules.AssertCalled(t, "Reload", key)
93 })
94}
95
96func TestModulesData(t *testing.T, s Server) {
97 key := ari.NewKey(ari.ModuleKey, "m1")

Callers 2

TestModulesReloadFunction · 0.92
TestModulesReloadFunction · 0.92

Calls 5

runTestFunction · 0.85
ReloadMethod · 0.80
ModulesMethod · 0.80
AsteriskMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected