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

Function TestLoggingCreate

internal/integration/logging.go:66–89  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

64}
65
66func TestLoggingCreate(t *testing.T, s Server) {
67 key := ari.NewKey(ari.LoggingKey, "n1")
68 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
69 m.Logging.On("Create", key, "l1").Return(ari.NewLogHandle(key, m.Logging), nil)
70
71 _, err := cl.Asterisk().Logging().Create(key, "l1")
72 if err != nil {
73 t.Errorf("Unexpected error in logging create: %s", err)
74 }
75
76 m.Logging.AssertCalled(t, "Create", key, "l1")
77 })
78
79 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
80 m.Logging.On("Create", key, "l1").Return(nil, errors.New("error"))
81
82 _, err := cl.Asterisk().Logging().Create(key, "l1")
83 if err == nil {
84 t.Errorf("Expected error in logging create")
85 }
86
87 m.Logging.AssertCalled(t, "Create", key, "l1")
88 })
89}
90
91func TestLoggingDelete(t *testing.T, s Server) {
92 key := ari.NewKey(ari.LoggingKey, "n1")

Callers 2

TestLoggingCreateFunction · 0.92
TestLoggingCreateFunction · 0.92

Calls 5

runTestFunction · 0.85
LoggingMethod · 0.80
AsteriskMethod · 0.80
NewMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected