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

Function TestBridgeData

internal/integration/bridge.go:96–135  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

94}
95
96func TestBridgeData(t *testing.T, s Server) {
97 key := ari.NewKey(ari.BridgeKey, "bridge1")
98
99 runTest("simple", t, s, func(t *testing.T, m *mock, cl ari.Client) {
100 bd := &ari.BridgeData{
101 ID: "bridge1",
102 Class: "class1",
103 ChannelIDs: []string{"channel1", "channel2"},
104 }
105 m.Bridge.On("Data", key).Return(bd, nil)
106
107 ret, err := cl.Bridge().Data(key)
108 if err != nil {
109 t.Errorf("Unexpected error in remote data call: %v", err)
110 }
111 if ret == nil || ret.ID != bd.ID || ret.Class != bd.Class {
112 t.Errorf("bridge data mismatchde")
113 }
114
115 m.Shutdown()
116
117 m.Bridge.AssertCalled(t, "Data", key)
118 })
119
120 runTest("error", t, s, func(t *testing.T, m *mock, cl ari.Client) {
121 m.Bridge.On("Data", key).Return(nil, eris.New("Error getting data"))
122
123 ret, err := cl.Bridge().Data(key)
124 if err == nil {
125 t.Errorf("Expected error to be non-nil")
126 }
127 if ret != nil {
128 t.Errorf("Expected bridge data to be nil")
129 }
130
131 m.Shutdown()
132
133 m.Bridge.AssertCalled(t, "Data", key)
134 })
135}
136
137func TestBridgeAddChannel(t *testing.T, s Server) {
138 key := ari.NewKey(ari.BridgeKey, "bridge1")

Callers 2

TestBridgeDataFunction · 0.92
TestBridgeDataFunction · 0.92

Calls 4

runTestFunction · 0.85
BridgeMethod · 0.80
NewMethod · 0.80
DataMethod · 0.45

Tested by

no test coverage detected