Test that deletion fails when related instances exist