'LogEntry.get_admin_url returns a URL to edit the entry\'s object or None for non-existent (possibly deleted) models'

def test_logentry_get_admin_url(self):

    log_entry_name = u'Model    with    string    primary    key'
    logentry = LogEntry.objects.get(content_type__name__iexact=log_entry_name)
    model = u'modelwithstringprimarykey'
    desired_admin_url = (u'/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 = u'non-existent'
    self.assertEqual(logentry.get_admin_url(), None)
