Python django.contrib.sitemaps.GenericSitemap() Examples

The following are 2 code examples for showing how to use django.contrib.sitemaps.GenericSitemap(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

You may also check out all available functions/classes of the module django.contrib.sitemaps , or try the search function .

Example 1
Project: djongo   Author: nesdis   File: test_generic.py    License: 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
Project: djongo   Author: nesdis   File: test_generic.py    License: 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)