﻿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
15751	test_requestsite_sitemap in SitemapTests is setting Site._meta.installed to False permanently	lucho	nobody	"test_requestsite_sitemap in SitemapTests is setting Site._meta.installed to False permanently - [http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/tests/basic.py#L147]

This prevents the remaining tests in the suit to be executed correct, when django.contrib.sites is installed app.

The observed result: SitemapTests.test_simple_sitemap failed.

{{{
======================================================================
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 problem: setUp determines incorrect the base_url, because Site._meta.installed was set permanently to False in test_requestsite_sitemap and never set back to correct value.

[http://code.djangoproject.com/browser/django/trunk/django/contrib/sitemaps/tests/basic.py#L18]
{{{
def setUp(self):
        if Site._meta.installed:
            self.base_url = 'http://example.com'
        else:
            self.base_url = 'http://testserver'
}}}

"	Bug	closed	contrib.sitemaps	1.3	Normal	invalid	test_requestsite_sitemap		Unreviewed	0	0	0	0	0	0
