mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[1.2.X] Fixed #14123 -- Made AdminDocs tests optional, based on the availability 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
This commit is contained in:
parent
5588870529
commit
c9016c15a9
@ -2171,39 +2171,46 @@ class UserAdminTest(TestCase):
|
|||||||
self.assertEquals(User.objects.count(), user_count + 1)
|
self.assertEquals(User.objects.count(), user_count + 1)
|
||||||
self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
|
self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
|
||||||
|
|
||||||
class AdminDocsTest(TestCase):
|
try:
|
||||||
fixtures = ['admin-views-users.xml']
|
# If docutils isn't installed, skip the AdminDocs tests.
|
||||||
|
import docutils
|
||||||
|
|
||||||
def setUp(self):
|
class AdminDocsTest(TestCase):
|
||||||
self.client.login(username='super', password='secret')
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def tearDown(self):
|
def setUp(self):
|
||||||
self.client.logout()
|
self.client.login(username='super', password='secret')
|
||||||
|
|
||||||
def test_tags(self):
|
def tearDown(self):
|
||||||
response = self.client.get('/test_admin/admin/doc/tags/')
|
self.client.logout()
|
||||||
|
|
||||||
# The builtin tag group exists
|
def test_tags(self):
|
||||||
self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
|
response = self.client.get('/test_admin/admin/doc/tags/')
|
||||||
|
|
||||||
# A builtin tag exists in both the index and detail
|
# The builtin tag group exists
|
||||||
self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
|
self.assertContains(response, "<h2>Built-in tags</h2>", count=2)
|
||||||
self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
|
|
||||||
|
|
||||||
# An app tag exists in both the index and detail
|
# A builtin tag exists in both the index and detail
|
||||||
# The builtin tag group exists
|
self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
|
||||||
self.assertContains(response, "<h2>admin_list</h2>", count=2)
|
self.assertContains(response, '<li><a href="#autoescape">autoescape</a></li>')
|
||||||
|
|
||||||
# A builtin tag exists in both the index and detail
|
# An app tag exists in both the index and detail
|
||||||
self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
|
# The builtin tag group exists
|
||||||
self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
|
self.assertContains(response, "<h2>admin_list</h2>", count=2)
|
||||||
|
|
||||||
def test_filters(self):
|
# A builtin tag exists in both the index and detail
|
||||||
response = self.client.get('/test_admin/admin/doc/filters/')
|
self.assertContains(response, '<h3 id="autoescape">autoescape</h3>')
|
||||||
|
self.assertContains(response, '<li><a href="#admin_actions">admin_actions</a></li>')
|
||||||
|
|
||||||
# The builtin filter group exists
|
def test_filters(self):
|
||||||
self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
|
response = self.client.get('/test_admin/admin/doc/filters/')
|
||||||
|
|
||||||
# A builtin filter exists in both the index and detail
|
# The builtin filter group exists
|
||||||
self.assertContains(response, '<h3 id="add">add</h3>')
|
self.assertContains(response, "<h2>Built-in filters</h2>", count=2)
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user