'Test the private method _send_notification with opt-out.
Test that _send_notification does not notify when a valid
notification_opt_out configuration is provided.'

def test_send_notification_with_opt_out(self):

    resource = uuid.uuid4().hex
    resource_type = EXP_RESOURCE_TYPE
    operation = CREATED_OPERATION
    event_type = ('identity.%s.created' % resource_type)
    conf = self.useFixture(config_fixture.Config(CONF))
    conf.config(notification_opt_out=[event_type])
    with mock.patch.object(notifications._get_notifier(), '_notify') as mocked:
        notifications._send_notification(operation, resource_type, resource)
        mocked.assert_not_called()
