

@mock.patch('nova.rpc.NOTIFIER')
def test_not_possible_to_emit_if_not_populated(self, mock_notifier):
    non_populated_payload = self.TestNotificationPayload(extra_field='test string')
    noti = self.TestNotification(event_type=notification.EventType(object='test_object', action=fields.NotificationAction.UPDATE), publisher=notification.NotificationPublisher.from_service_obj(self.service_obj), priority=fields.NotificationPriority.INFO, payload=non_populated_payload)
    mock_context = mock.Mock()
    self.assertRaises(AssertionError, noti.emit, mock_context)
    self.assertFalse(mock_notifier.called)

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/objects/test_notification.py TestNotificationBase.test_not_possible_to_emit_if_not_populated/original