diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-19 13:11:24 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-19 13:11:24 +0000 |
| commit | a352154e42d7bcb63994c7deefc976a989dcb0cd (patch) | |
| tree | 052ed1809a1b36cdc742809e193cd533f0229d9b | |
| parent | 806c30cd634c1654c8050b64ff4b46dc559c9eb8 (diff) | |
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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13606 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index bb787be638..f5a54f3f6c 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -2171,39 +2171,46 @@ class UserAdminTest(TestCase): 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 |
