diff options
| author | Petr DlouhĂ˝ <petr.dlouhy@email.cz> | 2013-08-01 09:51:01 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-02 12:51:46 -0400 |
| commit | 4e7745cc1c89a0c464b752e6da7c1fe7bce948d0 (patch) | |
| tree | 302406085a98f2bc85b5daaf9c6c207c9ed5130d /tests/admin_views/tests.py | |
| parent | 4f8fb199948eab417961a8df66e5c41354d9fd0d (diff) | |
[1.6.x] Fixed LogEntry.get_admin_url() for non-existent models.
Regression introduced by [369b6fa]; refs #18169.
Backport of 1b47508ac8 from master
Diffstat (limited to 'tests/admin_views/tests.py')
| -rw-r--r-- | tests/admin_views/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 9374dfff24..3c276199ff 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1525,6 +1525,17 @@ class AdminViewStringPrimaryKeyTest(TestCase): self.assertEqual(counted_presence_before - 1, counted_presence_after) + def test_logentry_get_admin_url(self): + "LogEntry.get_admin_url returns a URL to edit the entry's object or None for non-existent (possibly deleted) models" + log_entry_name = "Model with string primary key" # capitalized in Recent Actions + logentry = LogEntry.objects.get(content_type__name__iexact=log_entry_name) + model = "modelwithstringprimarykey" + desired_admin_url = "/test_admin/admin/admin_views/%s/%s/" % (model, escape(iri_to_uri(urlquote(quote(self.pk))))) + self.assertEqual(logentry.get_admin_url(), desired_admin_url) + + logentry.content_type.model = "non-existent" + self.assertEqual(logentry.get_admin_url(), None) + 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)) |
