'The shortcut view works if a model\'s ForeignKey to site is None.'

@mock.patch('django.apps.apps.get_model')
def test_shortcut_view_with_null_site_fk(self, get_model):

    get_model.side_effect = (lambda *args, **kwargs: (MockSite if (args[0] == 'sites.Site') else ModelWithNullFKToSite))
    obj = ModelWithNullFKToSite.objects.create(title='title')
    url = ('/shortcut/%s/%s/' % (ContentType.objects.get_for_model(ModelWithNullFKToSite).id, obj.pk))
    response = self.client.get(url)
    self.assertRedirects(response, ('%s' % obj.get_absolute_url()), fetch_redirect_response=False)
