def test_broadcast_success(*fixtures): mock1 = StreamingClientMock() mock2 = StreamingClientMock() broadcast = BroadcastStreamingClient({'BROADCAST_CLIENTS': [mock1, mock2]}) success = broadcast.send({'test': 'message'}) assert success assert mock1.get_sent() and mock2.get_sent()
def test_broadcast_failure(*fixtures): mock1 = StreamingClientMock() mock2 = StreamingClientMock() mock3 = StreamingClientMock() broadcast = BroadcastStreamingClient( {'BROADCAST_CLIENTS': [mock1, mock2, mock3]}) mock2.set_fail_send(True) success = broadcast.send({'test': 'message'}) assert not success assert mock1.get_sent() and not mock2.get_sent() and mock3.get_sent()