コード例 #1
0
ファイル: debug.py プロジェクト: timothyclemans/djangocg
 def test_403(self):
     # Ensure no 403.html template exists to test the default case.
     setup_test_template_loader({})
     try:
         response = self.client.get('/views/raises403/')
         self.assertContains(response, '<h1>403 Forbidden</h1>', status_code=403)
     finally:
         restore_template_loaders()
コード例 #2
0
ファイル: debug.py プロジェクト: timothyclemans/djangocg
 def test_403_template(self):
     # Set up a test 403.html template.
     setup_test_template_loader(
         {'403.html': 'This is a test template for a 403 Forbidden error.'}
     )
     try:
         response = self.client.get('/views/raises403/')
         self.assertContains(response, 'test template', status_code=403)
     finally:
         restore_template_loaders()