コード例 #1
0
    def test_with_valid_template(self):
        """Testing render_custom_content with a valid template"""
        s = render_custom_content(
            '{% if mybool %}{{s1}}{% else %}{{s2}}{% endif %}', {
                'mybool': True,
                's1': 'Hi!',
                's2': 'Bye!',
            })

        self.assertEqual(s, 'Hi!')
コード例 #2
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
    def test_with_valid_template(self):
        """Testing render_custom_content with a valid template"""
        s = render_custom_content(
            '{% if mybool %}{{s1}}{% else %}{{s2}}{% endif %}',
            {
                'mybool': True,
                's1': 'Hi!',
                's2': 'Bye!',
            })

        self.assertEqual(s, 'Hi!')
コード例 #3
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_unknown_vars(self):
     """Tests render_custom_content with unknown variables"""
     s = render_custom_content('{{settings.DEBUG}};{{settings.DATABASES}}')
     self.assertEqual(s, ';')
コード例 #4
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_blocked_ssi_tag(self):
     """Tests render_custom_content with blocked {% ssi %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'ssi'"):
         render_custom_content('{% ssi "foo.html" %}')
コード例 #5
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_blocked_load_tag(self):
     """Tests render_custom_content with blocked {% load %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'load'"):
         render_custom_content('{% load i18n %}')
コード例 #6
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_blocked_include_tag(self):
     """Tests render_custom_content with blocked {% include %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'include'"):
         render_custom_content('{% include "base.html" %}')
コード例 #7
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_blocked_debug_tag(self):
     """Tests render_custom_content with blocked {% debug %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'debug'"):
         render_custom_content('{% debug %}')
コード例 #8
0
ファイル: tests.py プロジェクト: liwei-ch/reviewboard
 def test_with_blocked_block_tag(self):
     """Tests render_custom_content with blocked {% block %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'block'"):
         render_custom_content('{% block foo %}{% endblock %})')
コード例 #9
0
 def test_with_blocked_extends_tag(self):
     """Testing render_custom_content with blocked {% extends %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'extends'"):
         render_custom_content('{% extends "base.html" %}')
コード例 #10
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_blocked_ssi_tag(self):
     """Testing render_custom_content with blocked {% ssi %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'ssi'"):
         render_custom_content('{% ssi "foo.html" %}')
コード例 #11
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_blocked_load_tag(self):
     """Testing render_custom_content with blocked {% load %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'load'"):
         render_custom_content('{% load i18n %}')
コード例 #12
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_blocked_include_tag(self):
     """Testing render_custom_content with blocked {% include %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'include'"):
         render_custom_content('{% include "base.html" %}')
コード例 #13
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_blocked_debug_tag(self):
     """Testing render_custom_content with blocked {% debug %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'debug'"):
         render_custom_content('{% debug %}')
コード例 #14
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_blocked_block_tag(self):
     """Testing render_custom_content with blocked {% block %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'block'"):
         render_custom_content('{% block foo %}{% endblock %})')
コード例 #15
0
ファイル: test_webhooks.py プロジェクト: chipx86/reviewboard
 def test_with_unknown_vars(self):
     """Testing render_custom_content with unknown variables"""
     s = render_custom_content('{{settings.DEBUG}};{{settings.DATABASES}}')
     self.assertEqual(s, ';')
コード例 #16
0
ファイル: tests.py プロジェクト: Anastasiya2307/reviewboard
 def test_with_blocked_extends_tag(self):
     """Tests render_custom_content with blocked {% extends %}"""
     with self.assertRaisesMessage(TemplateSyntaxError,
                                   "Invalid block tag: 'extends'"):
         render_custom_content('{% extends "base.html" %}')