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

Function TestModulesLoad

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

Source from the content-addressed store, hash-verified

8)
9
10func TestModulesLoad(t *testing.T, s Server) {
11 key := ari.NewKey(ari.ModuleKey, "m1")
12 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
13 m.Modules.On("Load", key).Return(nil)
14
15 if err := cl.Asterisk().Modules().Load(key); err != nil {
16 t.Errorf("Unexpected error in module load: %s", err)
17 }
18
19 m.Shutdown()
20
21 m.Asterisk.AssertCalled(t, "Modules")
22 m.Modules.AssertCalled(t, "Load", key)
23 })
24 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
25 m.Modules.On("Load", key).Return(errors.New("error"))
26
27 if err := cl.Asterisk().Modules().Load(key); err == nil {
28 t.Errorf("Expected error in module load")
29 }
30
31 m.Shutdown()
32
33 m.Asterisk.AssertCalled(t, "Modules")
34 m.Modules.AssertCalled(t, "Load", key)
35 })
36}
37
38func TestModulesUnload(t *testing.T, s Server) {
39 key := ari.NewKey(ari.ModuleKey, "m1")

Callers 2

TestModulesLoadFunction · 0.92
TestModulesLoadFunction · 0.92

Calls 5

runTestFunction · 0.85
LoadMethod · 0.80
ModulesMethod · 0.80
AsteriskMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected