diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-12-12 16:55:42 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-15 22:28:37 +0100 |
| commit | 6c120508b6445cb0d6198b4eacccd411960686d2 (patch) | |
| tree | 95eda814c10c2d78b1f0d4dc258b55b17fecea49 /tests/admin_utils/test_logentry.py | |
| parent | 817bc5800b40bcc74534de5e5176919cb826494f (diff) | |
Refs #34462 -- Removed ModelAdmin.log_deletion() and LogEntryManager.log_action() per deprecation timeline.
Diffstat (limited to 'tests/admin_utils/test_logentry.py')
| -rw-r--r-- | tests/admin_utils/test_logentry.py | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/tests/admin_utils/test_logentry.py b/tests/admin_utils/test_logentry.py index e97441eb2e..491a220199 100644 --- a/tests/admin_utils/test_logentry.py +++ b/tests/admin_utils/test_logentry.py @@ -8,10 +8,9 @@ from django.contrib.contenttypes.models import ContentType from django.test import TestCase, override_settings from django.urls import reverse from django.utils import translation -from django.utils.deprecation import RemovedInDjango60Warning from django.utils.html import escape -from .models import Article, ArticleProxy, Car, InheritedLogEntryManager, Site +from .models import Article, ArticleProxy, Car, Site @override_settings(ROOT_URLCONF="admin_utils.urls") @@ -236,22 +235,6 @@ class LogEntryTests(TestCase): logentry = LogEntry.objects.first() self.assertEqual(repr(logentry), str(logentry.action_time)) - # RemovedInDjango60Warning. - def test_log_action(self): - msg = "LogEntryManager.log_action() is deprecated. Use log_actions() instead." - content_type_val = ContentType.objects.get_for_model(Article).pk - with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: - log_entry = LogEntry.objects.log_action( - self.user.pk, - content_type_val, - self.a1.pk, - repr(self.a1), - CHANGE, - change_message="Changed something else", - ) - self.assertEqual(log_entry, LogEntry.objects.latest("id")) - self.assertEqual(ctx.filename, __file__) - def test_log_actions(self): queryset = Article.objects.all().order_by("-id") msg = "Deleted Something" @@ -289,46 +272,6 @@ class LogEntryTests(TestCase): ] self.assertSequenceEqual(logs, expected_log_values) - # RemovedInDjango60Warning. - def test_log_action_fallback(self): - LogEntry.objects2 = InheritedLogEntryManager() - queryset = Article.objects.all().order_by("-id") - content_type = ContentType.objects.get_for_model(self.a1) - self.assertEqual(len(queryset), 3) - msg = ( - "The usage of log_action() is deprecated. Implement log_actions() instead." - ) - with ( - self.assertNumQueries(3), - self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx, - ): - LogEntry.objects2.log_actions(self.user.pk, queryset, DELETION) - self.assertEqual(ctx.filename, __file__) - log_values = ( - LogEntry.objects.filter(action_flag=DELETION) - .order_by("id") - .values_list( - "user", - "content_type", - "object_id", - "object_repr", - "action_flag", - "change_message", - ) - ) - expected_log_values = [ - ( - self.user.pk, - content_type.id, - str(obj.pk), - "Test Repr", - DELETION, - "", - ) - for obj in queryset - ] - self.assertSequenceEqual(log_values, expected_log_values) - def test_recentactions_without_content_type(self): """ If a LogEntry is missing content_type it will not display it in span |
