@mock.patch.object(rpc, 'get_allowed_exmods')
@mock.patch.object(rpc, 'RequestContextSerializer')
@mock.patch.object(messaging, 'get_rpc_transport')
@mock.patch.object(messaging, 'get_notification_transport')
@mock.patch.object(messaging, 'Notifier')
def test_init(self, mock_not, mock_noti_trans, mock_trans, mock_ser, mock_exmods):
    notifier = mock.Mock()
    transport = mock.Mock()
    noti_transport = mock.Mock()
    serializer = mock.Mock()
    conf = mock.Mock()
    mock_exmods.return_value = ['foo']
    mock_trans.return_value = transport
    mock_noti_trans.return_value = noti_transport
    mock_ser.return_value = serializer
    mock_not.return_value = notifier
    rpc.init(conf)
    mock_exmods.assert_called_once_with()
    mock_trans.assert_called_once_with(conf, allowed_remote_exmods=['foo'])
    mock_noti_trans.assert_called_once_with(conf, allowed_remote_exmods=['foo'])
    mock_not.assert_called_once_with(noti_transport, serializer=serializer)
    self.assertIsNotNone(rpc.TRANSPORT)
    self.assertIsNotNone(rpc.NOTIFICATION_TRANSPORT)
    self.assertIsNotNone(rpc.NOTIFIER)
@mock.patch.object(rpc, 'get_allowed_exmods')
@mock.patch.object(rpc, 'RequestContextSerializer')
@mock.patch.object(messaging, 'get_rpc_transport')
@mock.patch.object(messaging, 'get_notification_transport')
@mock.patch.object(messaging, 'Notifier')
def test_init(self, mock_not, mock_noti_trans, mock_trans, mock_ser, mock_exmods):
    notifier = mock.Mock()
    transport = mock.Mock()
    noti_transport = mock.Mock()
    serializer = mock.Mock()
    conf = mock.Mock()
    mock_exmods.return_value = ['foo']
    mock_trans.return_value = transport
    mock_noti_trans.return_value = noti_transport
    mock_ser.return_value = serializer
    mock_not.return_value = notifier
    rpc.init(conf)
    mock_exmods.assert_called_once_with()
    mock_trans.assert_called_once_with(conf, allowed_remote_exmods=['foo'])
    mock_noti_trans.assert_called_once_with(conf, allowed_remote_exmods=['foo'])
    mock_not.assert_called_once_with(noti_transport, serializer=serializer)
    self.assertIsNotNone(rpc.TRANSPORT)
    self.assertIsNotNone(rpc.NOTIFICATION_TRANSPORT)
    self.assertIsNotNone(rpc.NOTIFIER)