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

Function TestApplicationSubscribe

internal/integration/application.go:81–109  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

79}
80
81func TestApplicationSubscribe(t *testing.T, s Server) {
82 key := ari.NewKey(ari.ApplicationKey, "1")
83
84 runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) {
85 m.Application.On("Subscribe", key, "2").Return(nil)
86
87 if err := cl.Application().Subscribe(key, "2"); err != nil {
88 t.Errorf("Unexpected error in remote Subscribe call: %v", err)
89 }
90
91 m.Shutdown()
92
93 m.Application.AssertCalled(t, "Subscribe", key, "2")
94 })
95
96 runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) {
97 expected := eris.New("unknown error")
98
99 m.Application.On("Subscribe", key, "2").Return(expected)
100
101 if err := cl.Application().Subscribe(key, "2"); err == nil || eris.Cause(err).Error() != expected.Error() {
102 t.Errorf("Expected error '%v', got '%v'", expected, err)
103 }
104
105 m.Shutdown()
106
107 m.Application.AssertCalled(t, "Subscribe", key, "2")
108 })
109}
110
111func TestApplicationUnsubscribe(t *testing.T, s Server) {
112 key := ari.NewKey(ari.ApplicationKey, "1")

Callers 2

TestApplicationSubscribeFunction · 0.92
TestApplicationSubscribeFunction · 0.92

Calls 6

runTestFunction · 0.85
ApplicationMethod · 0.80
NewMethod · 0.80
CauseMethod · 0.65
SubscribeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected