aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_serializer_bulk_update.py
diff options
context:
space:
mode:
authorTom Christie2014-11-06 11:51:10 +0000
committerTom Christie2014-11-06 11:51:10 +0000
commit9923a6ce9013693ea1723e7895b3cab638d719fd (patch)
treefba92ca2d6f7512329b90148b93c2f6e4ad6f151 /tests/test_serializer_bulk_update.py
parenta919068c5df3677469064fa2e300d27ae4d6e39f (diff)
downloaddjango-rest-framework-9923a6ce9013693ea1723e7895b3cab638d719fd.tar.bz2
Fix tests for py2/3 compat
Diffstat (limited to 'tests/test_serializer_bulk_update.py')
-rw-r--r--tests/test_serializer_bulk_update.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_serializer_bulk_update.py b/tests/test_serializer_bulk_update.py
index 85b6b2fa..2259ee31 100644
--- a/tests/test_serializer_bulk_update.py
+++ b/tests/test_serializer_bulk_update.py
@@ -3,6 +3,7 @@ Tests to cover bulk create and update using serializers.
"""
from __future__ import unicode_literals
from django.test import TestCase
+from django.utils import six
from rest_framework import serializers
@@ -82,10 +83,12 @@ class BulkCreateSerializerTests(TestCase):
serializer = self.BookSerializer(data=data, many=True)
self.assertEqual(serializer.is_valid(), False)
+ text_type_string = six.text_type.__name__
+ message = 'Invalid data. Expected a dictionary, but got %s.' % text_type_string
expected_errors = [
- {'non_field_errors': ['Invalid data. Expected a dictionary, but got unicode.']},
- {'non_field_errors': ['Invalid data. Expected a dictionary, but got unicode.']},
- {'non_field_errors': ['Invalid data. Expected a dictionary, but got unicode.']}
+ {'non_field_errors': [message]},
+ {'non_field_errors': [message]},
+ {'non_field_errors': [message]}
]
self.assertEqual(serializer.errors, expected_errors)