'Check that the shortcut view (used for the admin "view on site"
functionality) returns a complete URL regardless of whether the sites
framework is installed'

@override_settings(ALLOWED_HOSTS=[u'example.com'])
def test_shortcut_view(self):

    request = HttpRequest()
    request.META = {u'SERVER_NAME': u'Example.com', u'SERVER_PORT': u'80'}
    user_ct = ContentType.objects.get_for_model(FooWithUrl)
    obj = FooWithUrl.objects.create(name=u'john')
    if Site._meta.installed:
        response = shortcut(request, user_ct.id, obj.id)
        self.assertEqual((u'http://%s/users/john/' % get_current_site(request).domain), response._headers.get(u'location')[1])
    Site._meta.installed = False
    response = shortcut(request, user_ct.id, obj.id)
    self.assertEqual(u'http://Example.com/users/john/', response._headers.get(u'location')[1])
