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

        request = HttpRequest()
        request.META = {
            "SERVER_NAME": "Example.com",
            "SERVER_PORT": "80",
        }
        user_ct = ContentType.objects.get_for_model(FooWithUrl)
        obj = FooWithUrl.objects.create(name="john")

        with self.modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'}):
            response = shortcut(request, user_ct.id, obj.id)
            self.assertEqual(
                "http://%s/users/john/" % get_current_site(request).domain,
                response._headers.get("location")[1]
            )

        with self.modify_settings(INSTALLED_APPS={'remove': 'django.contrib.sites'}):
            response = shortcut(request, user_ct.id, obj.id)
            self.assertEqual("http://Example.com/users/john/", response._headers.get("location")[1])
clears any cached state for a context
dataset/ETHPy150Open django/django/tests/contenttypes_tests/test_models.py/ContentTypesTests.test_shortcut_view--crossover with--dataset/ETHPy150Open manahl/mdf/mdf/nodes.py/MDFNode.clear