summaryrefslogtreecommitdiff
path: root/tests/admin_docs/tests.py
diff options
context:
space:
mode:
authorMarkus Holtermann <info@markusholtermann.eu>2015-04-13 17:23:20 +0200
committerMarkus Holtermann <info@markusholtermann.eu>2015-04-14 10:48:16 +0200
commit3caf7efb44712f89d6552076c240a3c898673a2c (patch)
treecc13c3297c4b227dae43c93ee8d1bedcf39c08c0 /tests/admin_docs/tests.py
parent508b06f3897409362f40682fc5a5ffc1ffbb04bd (diff)
Refs #24625 -- Filtered docutils warnings output in tests
Instead of setting ``warning_stream`` in the docutils config overrides to ``False`` I opted for filtering the stderr in the tests to keep the error output showing up in server logs. Thanks Tim Graham for the report and review
Diffstat (limited to 'tests/admin_docs/tests.py')
-rw-r--r--tests/admin_docs/tests.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index a59443adf4..76366714ec 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -9,6 +9,7 @@ from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase, modify_settings, override_settings
+from django.test.utils import captured_stderr
from .models import Company, Person
@@ -220,9 +221,8 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
def setUp(self):
self.client.login(username='super', password='secret')
- self.response = self.client.get(
- reverse('django-admindocs-models-detail',
- args=['admin_docs', 'person']))
+ with captured_stderr() as self.docutils_stderr:
+ self.response = self.client.get(reverse('django-admindocs-models-detail', args=['admin_docs', 'person']))
def test_method_excludes(self):
"""
@@ -295,6 +295,9 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
self.assertContains(self.response, '.. raw:: html\n :file: admin_docs/evilfile.txt')
self.assertContains(self.response, '<p>&quot;include&quot; directive disabled.</p>',)
self.assertContains(self.response, '.. include:: admin_docs/evilfile.txt')
+ out = self.docutils_stderr.getvalue()
+ self.assertIn('"raw" directive disabled', out)
+ self.assertIn('"include" directive disabled', out)
def test_model_with_many_to_one(self):
link = '<a class="reference external" href="/admindocs/models/%s/">%s</a>'