def test_category_sitemap(self): sitemap = CategorySitemap() self.assertEquals(len(sitemap.items()), 1) self.assertEquals(sitemap.lastmod(self.category), self.entry_2.creation_date) self.assertEquals(sitemap.lastmod(Category.objects.create( title='New', slug='new')), None) self.assertEquals(sitemap.priority(self.category), '1.0')
def test_category_sitemap(self): sitemap = CategorySitemap() items = sitemap.items() self.assertEqual(len(items), 2) self.assertEqual(sitemap.lastmod(items[0]), self.entry_2.last_update) self.assertEqual(sitemap.lastmod(items[1]), self.entry_1.last_update) self.assertEqual(sitemap.priority(items[0]), '1.0') self.assertEqual(sitemap.priority(items[1]), '0.5')
def test_empty_sitemap_issue_188(self): Entry.objects.all().delete() entry_sitemap = EntrySitemap() category_sitemap = CategorySitemap() author_sitemap = AuthorSitemap() tag_sitemap = TagSitemap() self.assertEquals(len(entry_sitemap.items()), 0) self.assertEquals(len(category_sitemap.items()), 0) self.assertEquals(len(author_sitemap.items()), 0) self.assertEquals(len(tag_sitemap.items()), 0)
def test_category_sitemap(self): sitemap = CategorySitemap() items = sitemap.items() self.assertEquals(len(items), 2) self.assertEquals(sitemap.lastmod(items[0]), self.entry_2.last_update) self.assertEquals(sitemap.lastmod(items[1]), self.entry_1.last_update) self.assertEquals(sitemap.priority(items[0]), '1.0') self.assertEquals(sitemap.priority(items[1]), '0.5')
def test_category_sitemap(self): sitemap = CategorySitemap() with self.assertNumQueries(1): items = sitemap.items() self.assertEqual(len(items), 2) self.assertEqual( sitemap.lastmod(items[0]).replace(microsecond=0), self.entry_2.last_update.replace(microsecond=0)) self.assertEqual( sitemap.lastmod(items[1]).replace(microsecond=0), self.entry_1.last_update.replace(microsecond=0)) self.assertEqual(sitemap.priority(items[0]), '1.0') self.assertEqual(sitemap.priority(items[1]), '0.5')
def test_category_sitemap_zero_division_error(self): Entry.objects.all().delete() category_sitemap = CategorySitemap() category_sitemap.items() self.assertEquals(category_sitemap.priority(self.category), '0.5')