(t *testing.T, s Server)
| 94 | } |
| 95 | |
| 96 | func 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 | |
| 137 | func TestBridgeAddChannel(t *testing.T, s Server) { |
| 138 | key := ari.NewKey(ari.BridgeKey, "bridge1") |
no test coverage detected