Пример #1
0
    def test_templatetag_without_ESI(self, mock_reverse, mock_resolve):
        settings.USE_ESI = False

        mock_reverse.return_value = '/hah/blah'
        mock_resolve.return_value = [TemplatetagsTest.fake_view, None, {}]

        context = {'request': self.request}
        content = esi(context, 'fake_view', year='2013', month='05')

        self.assertEqual(content, 'fake content')
Пример #2
0
    def test_templatetag_with_ESI(self, mock_reverse, mock_resolve):
        settings.USE_ESI = True

        mock_reverse.return_value = '/hah/blah'
        mock_resolve.return_value = [TemplatetagsTest.fake_view, None, {}]

        context = {'request': self.request}
        content = esi(context, 'fake_view', year='2013', month='05')

        regexp = re.compile(r'<esi:include src="http://.*/hah/blah"/>')
        self.assertTrue(regexp.search(content) is not None)
Пример #3
0
    def test_templatetag_without_ESI(self,mock_reverse, mock_resolve):
        settings.USE_ESI = False
        
        mock_reverse.return_value = '/hah/blah'
        mock_resolve.return_value = [TemplatetagsTest.fake_view, None, {}]
        
        context = {
            'request': self.request
        }
        content = esi(context, 'fake_view', year='2013', month='05')

        self.assertEqual(content, 'fake content')
Пример #4
0
    def test_templatetag_with_ESI(self,mock_reverse, mock_resolve):
        settings.USE_ESI = True
        
        mock_reverse.return_value = '/hah/blah'
        mock_resolve.return_value = [TemplatetagsTest.fake_view, None, {}]
        
        context = {
            'request': self.request
        }
        content = esi(context, 'fake_view', year='2013', month='05')

        regexp = re.compile(r'<esi:include src="http://.*/hah/blah"/>')
        self.assertTrue(regexp.search(content) is not None)