[1.8.x] Added test for LogEntry.get_edited_object(); refs #24244.

Backport of 74f8110e74 from master
This commit is contained in:
Varun Sharma 2015-03-22 03:29:48 +05:30 committed by Tim Graham
parent 015a9b928a
commit 8f5e8ab666
1 changed files with 6 additions and 0 deletions

View File

@ -2032,6 +2032,12 @@ class AdminViewStringPrimaryKeyTest(TestCase):
logentry.content_type.model = "non-existent" logentry.content_type.model = "non-existent"
self.assertEqual(logentry.get_admin_url(), None) self.assertEqual(logentry.get_admin_url(), None)
def test_logentry_get_edited_object(self):
"LogEntry.get_edited_object returns the edited object of a given LogEntry object"
logentry = LogEntry.objects.get(content_type__model__iexact="modelwithstringprimarykey")
edited_obj = logentry.get_edited_object()
self.assertEqual(logentry.object_id, str(edited_obj.pk))
def test_deleteconfirmation_link(self): def test_deleteconfirmation_link(self):
"The link from the delete confirmation page referring back to the changeform of the object should be quoted" "The link from the delete confirmation page referring back to the changeform of the object should be quoted"
response = self.client.get(reverse('admin:admin_views_modelwithstringprimarykey_delete', args=(quote(self.pk),))) response = self.client.get(reverse('admin:admin_views_modelwithstringprimarykey_delete', args=(quote(self.pk),)))