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

Function TestModulesUnload

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

Source from the content-addressed store, hash-verified

36}
37
38func TestModulesUnload(t *testing.T, s Server) {
39 key := ari.NewKey(ari.ModuleKey, "m1")
40
41 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
42 m.Modules.On("Unload", key).Return(nil)
43
44 if err := cl.Asterisk().Modules().Unload(key); err != nil {
45 t.Errorf("Unexpected error in module Unload: %s", err)
46 }
47
48 m.Shutdown()
49
50 m.Asterisk.AssertCalled(t, "Modules")
51 m.Modules.AssertCalled(t, "Unload", key)
52 })
53 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
54 m.Modules.On("Unload", key).Return(errors.New("error"))
55
56 if err := cl.Asterisk().Modules().Unload(key); err == nil {
57 t.Errorf("Expected error in module Unload")
58 }
59
60 m.Shutdown()
61
62 m.Asterisk.AssertCalled(t, "Modules")
63 m.Modules.AssertCalled(t, "Unload", key)
64 })
65}
66
67func TestModulesReload(t *testing.T, s Server) {
68 key := ari.NewKey(ari.ModuleKey, "m1")

Callers 2

TestModulesUnloadFunction · 0.92
TestModulesUnloadFunction · 0.92

Calls 5

runTestFunction · 0.85
UnloadMethod · 0.80
ModulesMethod · 0.80
AsteriskMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected