Пример #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)
Пример #2
0
 def test_attributes(self):
     with pytest.raises(NotImplementedError):
         SitemapMixin().loc
Пример #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>"
Пример #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>"
Пример #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)