Esempio n. 1
0
 def test_sitemap_to_xml(self):
     assert SitemapMixin.to_sitemap_xml(
         "http://example.com",
         False) == "<url><loc>http://example.com</loc></url>"
     assert SitemapMixin.to_sitemap_xml("http://example.com").startswith(
         "<url><loc>http://example.com</loc><lastmod>")
     assert "<lastmod>2012-01-01</lastmod>" in SitemapMixin.to_sitemap_xml(
         "http://example.com", datetime(2012, 1, 1))
     assert "<changefreq>daily</changefreq>" in SitemapMixin.to_sitemap_xml(
         "http://example.com", False, "daily")
     assert "<priority>1.0</priority>" in SitemapMixin.to_sitemap_xml(
         "http://example.com", False, priority=1.0)
Esempio n. 2
0
 def test_attributes(self):
     with pytest.raises(NotImplementedError):
         SitemapMixin().loc
Esempio n. 3
0
 def test_sitemap_escaping(self):
     """ http://www.sitemaps.org/protocol.html#escaping
 """
     assert SitemapMixin.to_sitemap_xml(
         "http://example.com/&\'\"><", False
     ) == "<url><loc>http://example.com/&amp;&apos;&quot;&gt;&lt;</loc></url>"
Esempio n. 4
0
 def test_sitemap_escaping(self):
   """ http://www.sitemaps.org/protocol.html#escaping
   """
   assert SitemapMixin.to_sitemap_xml("http://example.com/&\'\"><", False) == "<url><loc>http://example.com/&amp;&apos;&quot;&gt;&lt;</loc></url>"
Esempio n. 5
0
 def test_sitemap_to_xml(self):
   assert SitemapMixin.to_sitemap_xml("http://example.com", False) == "<url><loc>http://example.com</loc></url>"
   assert SitemapMixin.to_sitemap_xml("http://example.com").startswith("<url><loc>http://example.com</loc><lastmod>")
   assert "<lastmod>2012-01-01</lastmod>" in SitemapMixin.to_sitemap_xml("http://example.com", datetime(2012,1,1))
   assert "<changefreq>daily</changefreq>" in SitemapMixin.to_sitemap_xml("http://example.com", False, "daily")
   assert "<priority>1.0</priority>" in SitemapMixin.to_sitemap_xml("http://example.com", False, priority=1.0)