

def _test_init(self, mock_notif, mock_noti_trans, mock_trans, mock_ser, mock_exmods, notif_format, expected_driver_topic_kwargs):
    legacy_notifier = mock.Mock()
    notifier = mock.Mock()
    notif_transport = mock.Mock()
    transport = mock.Mock()
    serializer = mock.Mock()
    conf = mock.Mock()
    conf.notification_format = notifier
    mock_exmods.return_value = ['foo']
    mock_trans.return_value = transport
    mock_noti_trans.return_value = notif_transport
    mock_ser.return_value = serializer
    mock_notif.side_effect = [legacy_notifier, notifier]
    rpc.init(conf)
    mock_exmods.assert_called_once_with()
    mock_trans.assert_called_once_with(conf, allowed_remote_exmods=['foo'], aliases=rpc.TRANSPORT_ALIASES)
    self.assertIsNotNone(rpc.TRANSPORT)
    self.assertIsNotNone(rpc.LEGACY_NOTIFIER)
    self.assertIsNotNone(rpc.NOTIFIER)
    self.assertEqual(legacy_notifier, rpc.LEGACY_NOTIFIER)
    self.assertEqual(notifier, rpc.NOTIFIER)
    expected_calls = []
    for kwargs in expected_driver_topic_kwargs:
        expected_kwargs = {
            'serializer': serializer,
        }
        expected_kwargs.update(kwargs)
        expected_calls.append(((notif_transport,), expected_kwargs))
    self.assertEqual(expected_calls, mock_notif.call_args_list, 'The calls to messaging.Notifier() did not create the legacy and versioned notifiers properly.')

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/test_rpc.py TestRPC._test_init/VarMisuse@76/108 `notif_format`->`notifier`