コード例 #1
0
ファイル: mixins.py プロジェクト: axelmagn/django-blog-zinnia
    def test_entry_queryset_archive_template_response_mixin(self):
        get_year = lambda: 2012
        get_week = lambda: 16
        get_month = lambda: '04'
        get_day = lambda: 21
        instance = EntryQuerysetArchiveTemplateResponseMixin()
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_year = get_year
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_week = get_week
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_month = get_month
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_day = get_day
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/archives/2012/04/21/entry_archive.html',
             'zinnia/archives/month/04/day/21/entry_archive.html',
             'zinnia/archives/2012/day/21/entry_archive.html',
             'zinnia/archives/day/21/entry_archive.html',
             'zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])

        instance.template_name = 'zinnia/entry_search.html'
        self.assertEquals(
            instance.get_template_names(),
            ['zinnia/entry_search.html',
             'zinnia/archives/2012/04/21/entry_archive.html',
             'zinnia/archives/month/04/day/21/entry_archive.html',
             'zinnia/archives/2012/day/21/entry_archive.html',
             'zinnia/archives/day/21/entry_archive.html',
             'zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
コード例 #2
0
    def test_entry_queryset_archive_template_response_mixin(self):
        def get_year():
            return 2012

        def get_week():
            return 16

        def get_month():
            return '04'

        def get_day():
            return 21

        instance = EntryQuerysetArchiveTemplateResponseMixin()
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_year = get_year
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_week = get_week
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_month = get_month
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
        instance.get_day = get_day
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/archives/2012/04/21/entry_archive.html',
             'zinnia/archives/month/04/day/21/entry_archive.html',
             'zinnia/archives/2012/day/21/entry_archive.html',
             'zinnia/archives/day/21/entry_archive.html',
             'zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])

        instance.template_name = 'zinnia/entry_search.html'
        self.assertEqual(
            instance.get_template_names(),
            ['zinnia/entry_search.html',
             'zinnia/archives/2012/04/21/entry_archive.html',
             'zinnia/archives/month/04/day/21/entry_archive.html',
             'zinnia/archives/2012/day/21/entry_archive.html',
             'zinnia/archives/day/21/entry_archive.html',
             'zinnia/archives/2012/month/04/entry_archive.html',
             'zinnia/archives/month/04/entry_archive.html',
             'zinnia/archives/2012/week/16/entry_archive.html',
             'zinnia/archives/week/16/entry_archive.html',
             'zinnia/archives/2012/entry_archive.html',
             'zinnia/archives/entry_archive.html',
             'zinnia/entry_archive.html',
             'entry_archive.html'])
コード例 #3
0
    def test_entry_queryset_archive_template_response_mixin(self):
        def get_year():
            return 2012

        def get_week():
            return 16

        def get_month():
            return '04'

        def get_day():
            return 21

        instance = EntryQuerysetArchiveTemplateResponseMixin()
        self.assertEqual(instance.get_template_names(), [
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_year = get_year
        self.assertEqual(instance.get_template_names(), [
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_week = get_week
        self.assertEqual(instance.get_template_names(), [
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_month = get_month
        self.assertEqual(instance.get_template_names(), [
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_day = get_day
        self.assertEqual(instance.get_template_names(), [
            'zinnia/archives/2012/04/21/entry_archive.html',
            'zinnia/archives/month/04/day/21/entry_archive.html',
            'zinnia/archives/2012/day/21/entry_archive.html',
            'zinnia/archives/day/21/entry_archive.html',
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])

        instance.template_name = 'zinnia/entry_search.html'
        self.assertEqual(instance.get_template_names(), [
            'zinnia/entry_search.html',
            'zinnia/archives/2012/04/21/entry_archive.html',
            'zinnia/archives/month/04/day/21/entry_archive.html',
            'zinnia/archives/2012/day/21/entry_archive.html',
            'zinnia/archives/day/21/entry_archive.html',
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
コード例 #4
0
ファイル: mixins.py プロジェクト: jLukeC/jlukecarlson-website
    def test_entry_queryset_archive_template_response_mixin(self):
        get_year = lambda: 2012
        get_week = lambda: 16
        get_month = lambda: '04'
        get_day = lambda: 21
        instance = EntryQuerysetArchiveTemplateResponseMixin()
        self.assertEquals(instance.get_template_names(), [
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_year = get_year
        self.assertEquals(instance.get_template_names(), [
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_week = get_week
        self.assertEquals(instance.get_template_names(), [
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_month = get_month
        self.assertEquals(instance.get_template_names(), [
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])
        instance.get_day = get_day
        self.assertEquals(instance.get_template_names(), [
            'zinnia/archives/2012/04/21/entry_archive.html',
            'zinnia/archives/month/04/day/21/entry_archive.html',
            'zinnia/archives/2012/day/21/entry_archive.html',
            'zinnia/archives/day/21/entry_archive.html',
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])

        instance.template_name = 'zinnia/entry_search.html'
        self.assertEquals(instance.get_template_names(), [
            'zinnia/entry_search.html',
            'zinnia/archives/2012/04/21/entry_archive.html',
            'zinnia/archives/month/04/day/21/entry_archive.html',
            'zinnia/archives/2012/day/21/entry_archive.html',
            'zinnia/archives/day/21/entry_archive.html',
            'zinnia/archives/2012/month/04/entry_archive.html',
            'zinnia/archives/month/04/entry_archive.html',
            'zinnia/archives/2012/week/16/entry_archive.html',
            'zinnia/archives/week/16/entry_archive.html',
            'zinnia/archives/2012/entry_archive.html',
            'zinnia/archives/entry_archive.html', 'zinnia/entry_archive.html',
            'entry_archive.html'
        ])