Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.2.X] Fixed #14123 -- Made AdminDocs tests optional, based on the a…

…vailability of docutils. Thanks to PaulM for the original report, and Łukasz Rekucki for narrowing down the cause.

Backport of r13606 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c9016c15a9a8d16f8ae557c869e23db28fc5b690 1 parent 5588870
Russell Keith-Magee freakboy3742 authored
Showing with 33 additions and 26 deletions.
  1. +33 −26 tests/regressiontests/admin_views/tests.py
59 tests/regressiontests/admin_views/tests.py
View
@@ -2171,39 +2171,46 @@ def test_user_add_another(self):
self.assertEquals(User.objects.count(), user_count + 1)
self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
-class AdminDocsTest(TestCase):
- fixtures = ['admin-views-users.xml']
+try:
+ # If docutils isn't installed, skip the AdminDocs tests.
+ import docutils
- def setUp(self):
- self.client.login(username='super', password='secret')
+ class AdminDocsTest(TestCase):
+ fixtures = ['admin-views-users.xml']
- def tearDown(self):
- self.client.logout()
+ def setUp(self):
+ self.client.login(username='super', password='secret')
+
+ def tearDown(self):
+ self.client.logout()
+
+ def test_tags(self):
+ response = self.client.get('/test_admin/admin/doc/tags/')
- def test_tags(self):
- response = self.client.get('/test_admin/admin/doc/tags/')
+ # The builtin tag group exists
+ self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
- # The builtin tag group exists
- self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
+ # A builtin tag exists in both the index and detail
+ self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
+ self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
- # A builtin tag exists in both the index and detail
- self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
- self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
+ # An app tag exists in both the index and detail
+ # The builtin tag group exists
+ self.assertContains(response, "<h2>admin_list</h2>", count=2)
- # An app tag exists in both the index and detail
- # The builtin tag group exists
- self.assertContains(response, "<h2>admin_list</h2>", count=2)
+ # A builtin tag exists in both the index and detail
+ self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
+ self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
- # A builtin tag exists in both the index and detail
- self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
- self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
+ def test_filters(self):
+ response = self.client.get('/test_admin/admin/doc/filters/')
- def test_filters(self):
- response = self.client.get('/test_admin/admin/doc/filters/')
+ # The builtin filter group exists
+ self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
- # The builtin filter group exists
- self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
+ # A builtin filter exists in both the index and detail
+ self.assertContains(response, '<h3 id="add">add</h3>')
+ self.assertContains(response, '<li><a href="#add">add</a></li>')
- # A builtin filter exists in both the index and detail
- self.assertContains(response, '<h3 id="add">add</h3>')
- self.assertContains(response, '<li><a href="#add">add</a></li>')
+except ImportError:
+ pass
Please sign in to comment.
Something went wrong with that request. Please try again.