summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-05-05 12:46:50 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-05-05 12:46:50 +0000
commit6541739765db8bb11a1ed87cce5e6c25b1e71d9a (patch)
tree66085d4739917983561a82d63933d15a7efcd6fd /tests
parentc03a0a7837a75aa135d0bad36fb9e01222292e48 (diff)
[1.0.X] Fixed #10275 -- Corrected the edge case of rendering a LogEntry with a contenttype of None. Thanks to Jarek Zgoda for the report, and Peter Bengtsson for the patch
Merge of r10675 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/admin_views/tests.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 4edfe27088..4aafa1947f 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -592,6 +592,26 @@ class AdminViewStringPrimaryKeyTest(TestCase):
should_contain = """<a href="admin_views/modelwithstringprimarykey/%s/">%s</a>""" % (quote(self.pk), escape(self.pk))
self.assertContains(response, should_contain)
+ def test_recentactions_without_content_type(self):
+ "If a LogEntry is missing content_type it will not display it in span tag under the hyperlink."
+ response = self.client.get('/test_admin/admin/')
+ should_contain = """<a href="admin_views/modelwithstringprimarykey/%s/">%s</a>""" % (quote(self.pk), escape(self.pk))
+ self.assertContains(response, should_contain)
+ should_contain = "Model with string primary key" # capitalized in Recent Actions
+ self.assertContains(response, should_contain)
+ logentry = LogEntry.objects.get(content_type__name__iexact=should_contain)
+ # http://code.djangoproject.com/ticket/10275
+ # if the log entry doesn't have a content type it should still be
+ # possible to view the Recent Actions part
+ logentry.content_type = None
+ logentry.save()
+
+ counted_presence_before = response.content.count(should_contain)
+ response = self.client.get('/test_admin/admin/')
+ counted_presence_after = response.content.count(should_contain)
+ self.assertEquals(counted_presence_before - 1,
+ counted_presence_after)
+
def test_deleteconfirmation_link(self):
"The link from the delete confirmation page referring back to the changeform of the object should be quoted"
response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/%s/delete/' % quote(self.pk))
@@ -919,7 +939,7 @@ class AdminInlineFileUploadTest(TestCase):
def setUp(self):
self.client.login(username='super', password='secret')
-
+
# Set up test Picture and Gallery.
# These must be set up here instead of in fixtures in order to allow Picture
# to use a NamedTemporaryFile.
@@ -938,7 +958,7 @@ class AdminInlineFileUploadTest(TestCase):
def test_inline_file_upload_edit_validation_error_post(self):
"""
- Test that inline file uploads correctly display prior data (#10002).
+ Test that inline file uploads correctly display prior data (#10002).
"""
post_data = {
"name": u"Test Gallery",