From a352154e42d7bcb63994c7deefc976a989dcb0cd Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 19 Aug 2010 13:11:24 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20#14123=20--=20Made=20AdminDocs=20tests?= =?UTF-8?q?=20optional,=20based=20on=20the=20availability=20of=20docutils.?= =?UTF-8?q?=20Thanks=20to=20PaulM=20for=20the=20original=20report,=20and?= =?UTF-8?q?=20=C5=81ukasz=20Rekucki=20for=20narrowing=20down=20the=20cause?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@13606 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/admin_views/tests.py | 59 ++++++++++++---------- 1 file 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 test_tags(self): - response = self.client.get('/test_admin/admin/doc/tags/') + def tearDown(self): + self.client.logout() - # The builtin tag group exists - self.assertContains(response, "

Built-in tags

", count=2) + def test_tags(self): + response = self.client.get('/test_admin/admin/doc/tags/') - # A builtin tag exists in both the index and detail - self.assertContains(response, '

autoescape

') - self.assertContains(response, '
  • autoescape
  • ') + # The builtin tag group exists + self.assertContains(response, "

    Built-in tags

    ", count=2) - # An app tag exists in both the index and detail - # The builtin tag group exists - self.assertContains(response, "

    admin_list

    ", count=2) + # A builtin tag exists in both the index and detail + self.assertContains(response, '

    autoescape

    ') + self.assertContains(response, '
  • autoescape
  • ') - # A builtin tag exists in both the index and detail - self.assertContains(response, '

    autoescape

    ') - self.assertContains(response, '
  • admin_actions
  • ') + # An app tag exists in both the index and detail + # The builtin tag group exists + self.assertContains(response, "

    admin_list

    ", count=2) - def test_filters(self): - response = self.client.get('/test_admin/admin/doc/filters/') + # A builtin tag exists in both the index and detail + self.assertContains(response, '

    autoescape

    ') + self.assertContains(response, '
  • admin_actions
  • ') - # The builtin filter group exists - self.assertContains(response, "

    Built-in filters

    ", count=2) + def test_filters(self): + response = self.client.get('/test_admin/admin/doc/filters/') - # A builtin filter exists in both the index and detail - self.assertContains(response, '

    add

    ') - self.assertContains(response, '
  • add
  • ') + # The builtin filter group exists + self.assertContains(response, "

    Built-in filters

    ", count=2) + + # A builtin filter exists in both the index and detail + self.assertContains(response, '

    add

    ') + self.assertContains(response, '
  • add
  • ') + +except ImportError: + pass