﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15753	test_simple_sitemap fails after executing test_requestsite_sitemap when Sites app and FetchFromCacheMiddleware are installed.	lucho	nobody	"test_simple_sitemap fails after executing test_requestsite_sitemap when Sites app and FetchFromCacheMiddleware are installed. 

The error:

{{{
======================================================================
 FAIL: test_simple_sitemap (django.contrib.sitemaps.tests.basic.SitemapTests)
 A simple sitemap can be rendered
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File ""/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/contrib/sitemaps/tests/basic.py"", line 70, in test_simple_sitemap
     """""" % (self.base_url, date.today().strftime('%Y-%m-%d')))
 AssertionError: '<?xml version=""1.0"" encoding=""UTF-8""?>\n<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">\n<url><loc>http://testserver/location/</loc><lastmod>2011-04-04</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>\n</urlset>\n' != '<?xml version=""1.0"" encoding=""UTF-8""?>\n<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">\n<url><loc>http://example.com/location/</loc><lastmod>2011-04-04</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>\n</urlset>\n'
 
}}}


The way to reproduce it:
1. Use Sites app in your project
2. Use FetchFromCacheMiddleware middleware in your project
3. Run the sitemaps.SitemapTests suite 

The code that triggers the problem is this [http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/tests/basic.py#L144]

{{{
# Which does that - setting the Site app as not installed and requesting the url
Site._meta.installed = False
response = self.client.get('/simple/sitemap.xml')
}}}

If I execute the test case separate (./manage.py test sitemaps.SitemapTests.test_simple_sitemap) no error is observed, but executing the whole test suite leads to error in test_simple_sitemap which is executed right after the test_requestsite_sitemap. 

If I comment out the test_requestsite_sitemap, no problem is observed. 
If I '''don't use (comment out) FetchFromCacheMiddleware''', no problem is observed.

This makes me think that it is some problem related to caching."	Bug	closed	contrib.sitemaps	dev	Normal	fixed	test	krzysiumed@…	Accepted	1	0	0	0	0	0
