summaryrefslogtreecommitdiff
path: root/tests/admin_views/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/admin_views/tests.py')
-rw-r--r--tests/admin_views/tests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 429f9d7b6c..7c299a4774 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -8,7 +8,7 @@ import unittest
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
-from django.contrib.admin.models import DELETION, LogEntry
+from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.options import TO_FIELD_VAR
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
@@ -1542,6 +1542,17 @@ class AdminViewPermissionsTest(TestCase):
self.assertEqual(mail.outbox[0].subject, 'Greetings from a created object')
self.client.get(reverse('admin:logout'))
+ # Check that the addition was logged correctly
+ addition_log = LogEntry.objects.all()[0]
+ new_article = Article.objects.last()
+ article_ct = ContentType.objects.get_for_model(Article)
+ self.assertEqual(addition_log.user_id, self.u2.pk)
+ self.assertEqual(addition_log.content_type_id, article_ct.pk)
+ self.assertEqual(addition_log.object_id, str(new_article.pk))
+ self.assertEqual(addition_log.object_repr, "Døm ikke")
+ self.assertEqual(addition_log.action_flag, ADDITION)
+ self.assertEqual(addition_log.change_message, "Added.")
+
# Super can add too, but is redirected to the change list view
self.client.get(self.index_url)
self.client.post(login_url, self.super_login)