Python django.contrib.sitemaps.GenericSitemap() Examples

The following are 2 code examples of django.contrib.sitemaps.GenericSitemap(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.contrib.sitemaps , or try the search function .
Example #1
Source File: test_generic.py    From djongo with GNU Affero General Public License v3.0 6 votes vote down vote up
def test_generic_sitemap_attributes(self):
        datetime_value = datetime.now()
        queryset = TestModel.objects.all()
        generic_sitemap = GenericSitemap(
            info_dict={
                'queryset': queryset,
                'date_field': datetime_value,
            },
            priority=0.6,
            changefreq='monthly',
            protocol='https',
        )
        attr_values = (
            ('date_field', datetime_value),
            ('priority', 0.6),
            ('changefreq', 'monthly'),
            ('protocol', 'https'),
        )
        for attr_name, expected_value in attr_values:
            with self.subTest(attr_name=attr_name):
                self.assertEqual(getattr(generic_sitemap, attr_name), expected_value)
        self.assertCountEqual(generic_sitemap.queryset, queryset) 
Example #2
Source File: test_generic.py    From djongo with GNU Affero General Public License v3.0 6 votes vote down vote up
def test_generic_sitemap_attributes(self):
        datetime_value = datetime.now()
        queryset = TestModel.objects.all()
        generic_sitemap = GenericSitemap(
            info_dict={
                'queryset': queryset,
                'date_field': datetime_value,
            },
            priority=0.6,
            changefreq='monthly',
            protocol='https',
        )
        attr_values = (
            ('date_field', datetime_value),
            ('priority', 0.6),
            ('changefreq', 'monthly'),
            ('protocol', 'https'),
        )
        for attr_name, expected_value in attr_values:
            with self.subTest(attr_name=attr_name):
                self.assertEqual(getattr(generic_sitemap, attr_name), expected_value)
        self.assertCountEqual(generic_sitemap.queryset, queryset)