mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Moved LogEntry-related tests to their own test case
Thanks Tim Graham for reviewing and contributing to the patch. Refs #21113.
This commit is contained in:
parent
0d855990f7
commit
35c41987ec
6 changed files with 178 additions and 124 deletions
|
@ -5,7 +5,6 @@ from decimal import Decimal
|
|||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin import helpers
|
||||
from django.contrib.admin.utils import (
|
||||
NestedObjects, display_for_field, flatten, flatten_fieldsets,
|
||||
|
@ -13,7 +12,6 @@ from django.contrib.admin.utils import (
|
|||
)
|
||||
from django.db import DEFAULT_DB_ALIAS, models
|
||||
from django.test import SimpleTestCase, TestCase, override_settings
|
||||
from django.utils import six
|
||||
from django.utils.formats import localize
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
@ -303,31 +301,6 @@ class UtilsTests(SimpleTestCase):
|
|||
('awesome guest', None),
|
||||
)
|
||||
|
||||
def test_logentry_unicode(self):
|
||||
"""
|
||||
Regression test for #15661
|
||||
"""
|
||||
log_entry = admin.models.LogEntry()
|
||||
|
||||
log_entry.action_flag = admin.models.ADDITION
|
||||
self.assertTrue(
|
||||
six.text_type(log_entry).startswith('Added ')
|
||||
)
|
||||
|
||||
log_entry.action_flag = admin.models.CHANGE
|
||||
self.assertTrue(
|
||||
six.text_type(log_entry).startswith('Changed ')
|
||||
)
|
||||
|
||||
log_entry.action_flag = admin.models.DELETION
|
||||
self.assertTrue(
|
||||
six.text_type(log_entry).startswith('Deleted ')
|
||||
)
|
||||
|
||||
# Make sure custom action_flags works
|
||||
log_entry.action_flag = 4
|
||||
self.assertEqual(six.text_type(log_entry), 'LogEntry Object')
|
||||
|
||||
def test_safestring_in_field_label(self):
|
||||
# safestring should not be escaped
|
||||
class MyForm(forms.Form):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue