Beispiel #1
0
    def test_sitemap_config(self):
        posts = self.get_posts()
        self.app_config_1.app_data.config.sitemap_changefreq = 'daily'
        self.app_config_1.app_data.config.sitemap_priority = '0.2'
        self.app_config_1.save()

        sitemap = BlogSitemap()
        self.assertEqual(len(sitemap.items()), 4)
        for item in sitemap.items():
            self.assertEqual(sitemap.lastmod(item).date(), now().date())
            if item.app_config == self.app_config_1:
                self.assertEqual(
                    sitemap.priority(item), '0.2'
                )
                self.assertEqual(
                    sitemap.changefreq(item), 'daily'
                )
            else:
                self.assertEqual(
                    sitemap.priority(item), get_setting('SITEMAP_PRIORITY_DEFAULT')
                )
                self.assertEqual(
                    sitemap.changefreq(item), get_setting('SITEMAP_CHANGEFREQ_DEFAULT')
                )
        self.assertEqual(
            sitemap.priority(None), get_setting('SITEMAP_PRIORITY_DEFAULT')
        )
        self.assertEqual(
            sitemap.changefreq(None), get_setting('SITEMAP_CHANGEFREQ_DEFAULT')
        )
Beispiel #2
0
 def test_sitemap(self):
     post1, post2 = self.get_posts()
     post1.tags.add('tag 1', 'tag 2', 'tag 3', 'tag 4')
     post1.save()
     post2.tags.add('tag 6', 'tag 2', 'tag 5', 'tag 8')
     post2.publish = True
     post2.save()
     post1.set_current_language('en')
     
     sitemap = BlogSitemap()
     self.assertEqual(sitemap.items().count(), 2)
     for item in sitemap.items():
         self.assertTrue(sitemap.lastmod(item).date(), now().today())
Beispiel #3
0
    def test_sitemap_with_unpublished(self):
        pages = self.get_pages()
        self.get_posts()
        sitemap = BlogSitemap()

        self.assertEqual(len(sitemap.items()), 4)

        # unpublish all the pages
        for page in pages:
            page.unpublish('en')
            page.unpublish('it')

        reload_urlconf()

        self.assertEqual(len(sitemap.items()), 0)
    def test_sitemap_with_unpublished(self):
        pages = self.get_pages()
        self.get_posts()
        sitemap = BlogSitemap()

        self.assertEqual(len(sitemap.items()), 4)

        # unpublish all the pages
        for page in pages:
            page.unpublish('en')
            page.unpublish('it')

        reload_urlconf()

        self.assertEqual(len(sitemap.items()), 0)
    def test_sitemap(self):
        self.get_pages()
        posts = self.get_posts()
        posts[0].tags.add("tag 1", "tag 2", "tag 3", "tag 4")
        posts[0].save()
        posts[1].tags.add("tag 6", "tag 2", "tag 5", "tag 8")
        posts[1].publish = True
        posts[1].save()
        posts[0].set_current_language("en")

        sitemap = BlogSitemap()
        self.assertEqual(len(sitemap.items()), 6)
        for item in sitemap.items():
            self.assertEqual(sitemap.lastmod(item).date(), now().date())
            self.assertEqual(sitemap.priority(item), get_setting("SITEMAP_PRIORITY_DEFAULT"))
            self.assertEqual(sitemap.changefreq(item), get_setting("SITEMAP_CHANGEFREQ_DEFAULT"))
            with smart_override(item.get_current_language()):
                self.assertEqual(sitemap.location(item), item.get_absolute_url())
Beispiel #6
0
    def test_sitemap(self):
        posts = self.get_posts()
        self.get_pages()
        posts[0].tags.add('tag 1', 'tag 2', 'tag 3', 'tag 4')
        posts[0].save()
        posts[1].tags.add('tag 6', 'tag 2', 'tag 5', 'tag 8')
        posts[1].publish = True
        posts[1].save()
        posts[0].set_current_language('en')

        sitemap = BlogSitemap()
        self.assertEqual(len(sitemap.items()), 6)
        for item in sitemap.items():
            self.assertEqual(sitemap.lastmod(item).date(), now().date())
            self.assertEqual(
                sitemap.priority(item), get_setting('SITEMAP_PRIORITY_DEFAULT')
            )
            self.assertEqual(
                sitemap.changefreq(item), get_setting('SITEMAP_CHANGEFREQ_DEFAULT')
            )
            with smart_override(item.get_current_language()):
                self.assertEqual(
                    sitemap.location(item), item.get_absolute_url()
                )
Beispiel #7
0
    def test_sitemap_config(self):
        self.get_pages()
        self.get_posts()
        self.app_config_1.app_data.config.sitemap_changefreq = 'daily'
        self.app_config_1.app_data.config.sitemap_priority = '0.2'
        self.app_config_1.save()

        sitemap = BlogSitemap()
        self.assertEqual(len(sitemap.items()), 4)
        for item in sitemap.items():
            self.assertEqual(sitemap.lastmod(item).date(), now().date())
            if item.app_config == self.app_config_1:
                self.assertEqual(sitemap.priority(item), '0.2')
                self.assertEqual(sitemap.changefreq(item), 'daily')
            else:
                self.assertEqual(sitemap.priority(item),
                                 get_setting('SITEMAP_PRIORITY_DEFAULT'))
                self.assertEqual(sitemap.changefreq(item),
                                 get_setting('SITEMAP_CHANGEFREQ_DEFAULT'))
        self.assertEqual(sitemap.priority(None),
                         get_setting('SITEMAP_PRIORITY_DEFAULT'))
        self.assertEqual(sitemap.changefreq(None),
                         get_setting('SITEMAP_CHANGEFREQ_DEFAULT'))