diff options
| author | Tom Christie | 2013-02-01 11:58:55 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-02-01 11:58:55 +0000 |
| commit | d9c7b1c58523d63c8118d88f44ebfdf5f35e942a (patch) | |
| tree | 6efc5a04556b1800756034791ce8aed082f25d4d /rest_framework/tests/files.py | |
| parent | 8021bb5d5089955b171173e60dcc0968e13d29ea (diff) | |
| parent | 0f0e76d8b1b7a7a28b4ce2c6d8f7ecc89e7219ff (diff) | |
| download | django-rest-framework-d9c7b1c58523d63c8118d88f44ebfdf5f35e942a.tar.bz2 | |
Merge branch 'p3k' of https://github.com/linovia/django-rest-framework into working
Conflicts:
rest_framework/authentication.py
rest_framework/relations.py
rest_framework/serializers.py
rest_framework/settings.py
rest_framework/tests/authentication.py
rest_framework/tests/genericrelations.py
rest_framework/tests/generics.py
rest_framework/tests/relations_hyperlink.py
rest_framework/tests/relations_nested.py
rest_framework/tests/relations_pk.py
rest_framework/tests/serializer.py
Diffstat (limited to 'rest_framework/tests/files.py')
| -rw-r--r-- | rest_framework/tests/files.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rest_framework/tests/files.py b/rest_framework/tests/files.py index 446e23c0..0434f900 100644 --- a/rest_framework/tests/files.py +++ b/rest_framework/tests/files.py @@ -1,9 +1,10 @@ -import StringIO import datetime from django.test import TestCase from rest_framework import serializers +from rest_framework.compat import BytesIO +from rest_framework.compat import six class UploadedFile(object): @@ -27,9 +28,9 @@ class UploadedFileSerializer(serializers.Serializer): class FileSerializerTests(TestCase): def test_create(self): now = datetime.datetime.now() - file = StringIO.StringIO('stuff') + file = BytesIO(six.b('stuff')) file.name = 'stuff.txt' - file.size = file.len + file.size = len(file.getvalue()) serializer = UploadedFileSerializer(data={'created': now}, files={'file': file}) uploaded_file = UploadedFile(file=file, created=now) self.assertTrue(serializer.is_valid()) |
