'Tests the flavor-delete notification with flavor.projects loaded.'

@mock.patch('nova.objects.Flavor._flavor_destroy')
def test_flavor_destroy_with_notification_and_projects(self, mock_destroy):

    flavor = copy.deepcopy(fake_flavor)
    flavorid = '1'
    flavor['flavorid'] = flavorid
    flavor['id'] = flavorid
    mock_destroy.return_value = flavor
    flavor_obj = objects.Flavor(context=self.ctxt, projects=['foo'], **flavor)
    flavor_obj.obj_reset_changes()
    self.assertIn('projects', flavor_obj)
    self.assertEqual(['foo'], flavor_obj.projects)
    self._verify_notification(flavor_obj, flavor, 'DELETE')
