<s> from datetime import date <EOL> from django . conf import settings <EOL> from django . contrib . auth . models import User <EOL> from django . contrib . sitemaps import Sitemap , GenericSitemap <EOL> from django . contrib . sites . models import Site <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from django . utils . unittest import skipUnless <EOL> from django . utils . formats import localize <EOL> from django . utils . translation import activate , deactivate <EOL> from . base import SitemapTestsBase <EOL> class HTTPSitemapTests ( SitemapTestsBase ) : <EOL> def test_simple_sitemap_index ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % self . base_url ) <EOL> def test_simple_sitemap_custom_index ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % self . base_url ) <EOL> def test_simple_sitemap_section ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % ( self . base_url , date . today ( ) ) ) <EOL> def test_simple_sitemap ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % ( self . base_url , date . today ( ) ) ) <EOL> def test_simple_custom_sitemap ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % ( self . base_url , date . today ( ) ) ) <EOL> @ skipUnless ( settings . USE_I18N , "<STR_LIT>" ) <EOL> def test_localized_priority ( self ) : <EOL> "<STR_LIT>" <EOL> settings . USE_L10N = True <EOL> activate ( '<STR_LIT>' ) <EOL> self . assertEqual ( u'<STR_LIT>' , localize ( <NUM_LIT> ) ) <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> self . assertContains ( response , '<STR_LIT>' % date . today ( ) ) <EOL> deactivate ( ) <EOL> def test_requestsite_sitemap ( self ) : <EOL> Site . _meta . installed = False <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % date . today ( ) ) <EOL> @ skipUnless ( "<STR_LIT>" in settings . INSTALLED_APPS , <EOL> "<STR_LIT>" ) <EOL> def test_sitemap_get_urls_no_site_1 ( self ) : <EOL> """<STR_LIT>""" <EOL> Site . objects . all ( ) . delete ( ) <EOL> self . assertRaises ( ImproperlyConfigured , Sitemap ( ) . get_urls ) <EOL> def test_sitemap_get_urls_no_site_2 ( self ) : <EOL> """<STR_LIT>""" <EOL> Site . _meta . installed = False <EOL> self . assertRaises ( ImproperlyConfigured , Sitemap ( ) . get_urls ) <EOL> def test_sitemap_item ( self ) : <EOL> """<STR_LIT>""" <EOL> user_sitemap = GenericSitemap ( { '<STR_LIT>' : User . objects . all ( ) } ) <EOL> def is_user ( url ) : <EOL> return isinstance ( url [ '<STR_LIT>' ] , User ) <EOL> item_in_url_info = all ( map ( is_user , user_sitemap . get_urls ( ) ) ) <EOL> self . assertTrue ( item_in_url_info ) <EOL> def test_cached_sitemap_index ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . content , """<STR_LIT>""" % self . base_url ) </s>
