diff options
| author | Alexey Boriskin <sun.void@gmail.com> | 2013-02-02 00:22:20 +0400 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-02-06 22:01:55 +0100 |
| commit | d18f796a481e79a3800d4672d6189e4c496cce3d (patch) | |
| tree | ba5734c5c01b61fde37ea2ab37bc88c637c36764 /tests | |
| parent | d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e (diff) | |
Fixed #19704 -- Make use of new ungettext_lazy function at appropriate places
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/comment_tests/tests/moderation_view_tests.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py index 0f83d5e210..0abeff9687 100644 --- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py +++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py @@ -1,9 +1,10 @@ -from __future__ import absolute_import +from __future__ import absolute_import, unicode_literals from django.contrib.auth.models import User, Permission from django.contrib.comments import signals from django.contrib.comments.models import Comment, CommentFlag from django.contrib.contenttypes.models import ContentType +from django.utils import translation from . import CommentTestCase @@ -281,3 +282,28 @@ class AdminActionsTests(CommentTestCase): response = self.client.get('/admin2/comments/comment/') self.assertEqual(response.status_code, 200) self.assertNotContains(response, '<option value="delete_selected">') + + def performActionAndCheckMessage(self, action, action_params, expected_message): + response = self.client.post('/admin/comments/comment/', + data={'_selected_action': action_params, + 'action': action, + 'index': 0}, + follow=True) + self.assertContains(response, expected_message) + + def testActionsMessageTranslations(self): + c1, c2, c3, c4 = self.createSomeComments() + one_comment = c1.pk + many_comments = [c2.pk, c3.pk, c4.pk] + makeModerator("normaluser") + self.client.login(username="normaluser", password="normaluser") + with translation.override('en'): + #Test approving + self.performActionAndCheckMessage('approve_comments', one_comment, '1 comment was successfully approved') + self.performActionAndCheckMessage('approve_comments', many_comments, '3 comments were successfully approved') + #Test flagging + self.performActionAndCheckMessage('flag_comments', one_comment, '1 comment was successfully flagged') + self.performActionAndCheckMessage('flag_comments', many_comments, '3 comments were successfully flagged') + #Test removing + self.performActionAndCheckMessage('remove_comments', one_comment, '1 comment was successfully removed') + self.performActionAndCheckMessage('remove_comments', many_comments, '3 comments were successfully removed') |
