diff -r d4e8cb5b1a72 django/contrib/auth/tests/views.py
--- a/django/contrib/auth/tests/views.py	Tue Jan 18 20:42:39 2011 +0100
+++ b/django/contrib/auth/tests/views.py	Tue Jan 18 21:56:34 2011 +0100
@@ -5,7 +5,7 @@
 from django.conf import settings
 from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
 from django.contrib.auth.forms import AuthenticationForm
-from django.contrib.sites.models import Site
+from django.contrib.sites.models import Site, RequestSite
 from django.contrib.auth.models import User
 from django.test import TestCase
 from django.core import mail
@@ -192,9 +192,12 @@
     def test_current_site_in_context_after_login(self):
         response = self.client.get(reverse('django.contrib.auth.views.login'))
         self.assertEquals(response.status_code, 200)
-        site = Site.objects.get_current()
-        self.assertEquals(response.context['site'], site)
-        self.assertEquals(response.context['site_name'], site.name)
+        if Site._meta.installed:
+            site = Site.objects.get_current()
+            self.assertEquals(response.context['site'], site)
+            self.assertEquals(response.context['site_name'], site.name)
+        else:
+            self.assertIsInstance(response.context['site'], RequestSite)
         self.assert_(isinstance(response.context['form'], AuthenticationForm), 
                      'Login form is not an AuthenticationForm')
 
diff -r d4e8cb5b1a72 django/contrib/contenttypes/tests.py
--- a/django/contrib/contenttypes/tests.py	Tue Jan 18 20:42:39 2011 +0100
+++ b/django/contrib/contenttypes/tests.py	Tue Jan 18 21:56:34 2011 +0100
@@ -61,9 +61,11 @@
         from django.contrib.auth.models import User
         user_ct = ContentType.objects.get_for_model(User)
         obj = User.objects.create(username="john")
-        Site._meta.installed = True
-        response = shortcut(request, user_ct.id, obj.id)
-        self.assertEqual("http://example.com/users/john/", response._headers.get("location")[1])
+
+        if Site._meta.installed:
+            response = shortcut(request, user_ct.id, obj.id)
+            self.assertEqual("http://example.com/users/john/", response._headers.get("location")[1])
+
         Site._meta.installed = False
         response = shortcut(request, user_ct.id, obj.id)
         self.assertEqual("http://Example.com/users/john/", response._headers.get("location")[1])
diff -r d4e8cb5b1a72 django/contrib/sitemaps/tests/basic.py
--- a/django/contrib/sitemaps/tests/basic.py	Tue Jan 18 20:42:39 2011 +0100
+++ b/django/contrib/sitemaps/tests/basic.py	Tue Jan 18 21:56:34 2011 +0100
@@ -15,6 +15,10 @@
     urls = 'django.contrib.sitemaps.tests.urls'
 
     def setUp(self):
+        if Site._meta.installed:
+            self.base_url = 'http://example.com'
+        else:
+            self.base_url = 'http://testserver'
         self.old_USE_L10N = settings.USE_L10N
         self.old_Site_meta_installed = Site._meta.installed
         self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
@@ -36,9 +40,9 @@
         # Check for all the important bits:
         self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?>
 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-<sitemap><loc>http://example.com/simple/sitemap-simple.xml</loc></sitemap>
+<sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap>
 </sitemapindex>
-""")
+""" % self.base_url)
 
     def test_simple_sitemap_custom_index(self):
         "A simple sitemap index can be rendered with a custom template"
@@ -48,9 +52,9 @@
         self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?>
 <!-- This is a customised template -->
 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-<sitemap><loc>http://example.com/simple/sitemap-simple.xml</loc></sitemap>
+<sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap>
 </sitemapindex>
-""")
+""" % self.base_url)
 
     def test_simple_sitemap(self):
         "A simple sitemap can be rendered"
@@ -59,9 +63,9 @@
         # Check for all the important bits:
         self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-<url><loc>http://example.com/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
+<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
 </urlset>
-""" % date.today().strftime('%Y-%m-%d'))
+""" % (self.base_url, date.today().strftime('%Y-%m-%d')))
 
     def test_simple_custom_sitemap(self):
         "A simple sitemap can be rendered with a custom template"
@@ -71,9 +75,9 @@
         self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?>
 <!-- This is a customised template -->
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-<url><loc>http://example.com/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
+<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
 </urlset>
-""" % date.today().strftime('%Y-%m-%d'))
+""" % (self.base_url, date.today().strftime('%Y-%m-%d')))
 
     @skipUnless(settings.USE_I18N, "Internationalization is not enabled")
     def test_localized_priority(self):
@@ -97,7 +101,7 @@
 
         expected = ''
         for username in User.objects.values_list("username", flat=True):
-            expected += "<url><loc>http://example.com/users/%s/</loc></url>" %username
+            expected += "<url><loc>%s/users/%s/</loc></url>" % (self.base_url, username)
         # Check for all the important bits:
         self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -131,9 +135,9 @@
         private.sites.add(settings.SITE_ID)
         response = self.client.get('/flatpages/sitemap.xml')
         # Public flatpage should be in the sitemap
-        self.assertContains(response, '<loc>http://example.com%s</loc>' % public.url)
+        self.assertContains(response, '<loc>%s%s</loc>' % (self.base_url, public.url))
         # Private flatpage should not be in the sitemap
-        self.assertNotContains(response, '<loc>http://example.com%s</loc>' % private.url)
+        self.assertNotContains(response, '<loc>%s%s</loc>' % (self.base_url, private.url))
 
     def test_requestsite_sitemap(self):
         # Make sure hitting the flatpages sitemap without the sites framework
@@ -163,6 +167,5 @@
         Sitemap.get_urls if Site objects exists, but the sites framework is not
         actually installed.
         """
-        Site.objects.get_current()
         Site._meta.installed = False
         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
