Kaynağa Gözat

Open binary files in the binary mode

Make sure that we are using binary mode to read binary files like images, this Fixes #20
tags/v1.0.0
Krzysztof Klimonda 11 yıl önce
ebeveyn
işleme
3b10868832
2 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. +1
    -1
      pinry/core/tests/api.py
  2. +2
    -2
      pinry/core/tests/helpers.py

+ 1
- 1
pinry/core/tests/api.py Dosyayı Görüntüle

@@ -19,7 +19,7 @@ def filter_generator_for(size):


def mock_requests_get(url):
response = mock.Mock(content=open('logo.png').read())
response = mock.Mock(content=open('logo.png', 'rb').read())
return response




+ 2
- 2
pinry/core/tests/helpers.py Dosyayı Görüntüle

@@ -1,6 +1,6 @@
from django.conf import settings
from django.contrib.auth.models import Permission
from django.core.files import File
from django.core.files.images import ImageFile
from django.db.models.query import QuerySet
from django.test import TestCase

@@ -33,7 +33,7 @@ class TagFactory(factory.Factory):


class ImageFactory(factory.Factory):
image = factory.LazyAttribute(lambda a: File(open(TEST_IMAGE_PATH)))
image = factory.LazyAttribute(lambda a: ImageFile(open(TEST_IMAGE_PATH, 'rb')))


class PinFactory(factory.Factory):


Yükleniyor…
İptal
Kaydet