File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import unicode_literals
2
2
3
3
from django .test import TestCase
4
- from django .utils import six
4
+ from django .utils import six , translation
5
5
from django .utils .translation import ugettext_lazy as _
6
6
7
7
from rest_framework .exceptions import (
8
- ErrorDetail , Throttled , _get_error_details
8
+ APIException , ErrorDetail , Throttled , _get_error_details
9
9
)
10
10
11
11
@@ -51,3 +51,12 @@ def test_get_full_details_with_throttling(self):
51
51
assert exception .get_full_details () == {
52
52
'message' : 'Slow down! Expected available in {} seconds.' .format (2 if six .PY3 else 2. ),
53
53
'code' : 'throttled' }
54
+
55
+
56
+ class TranslationTests (TestCase ):
57
+
58
+ @translation .override ('fr' )
59
+ def test_message (self ):
60
+ # this test largely acts as a sanity test to ensure the translation files are present.
61
+ self .assertEqual (_ ('A server error occurred.' ), 'Une erreur du serveur est survenue.' )
62
+ self .assertEqual (six .text_type (APIException ()), 'Une erreur du serveur est survenue.' )
You can’t perform that action at this time.
0 commit comments