Completed
Pull Request — master (#114)
by Johannes
52s
created

pytest_configure()   A

Complexity

Conditions 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A image_upload_file() 0 5 1
1
import io
2
3
import pytest
4
from django.core.files.uploadedfile import SimpleUploadedFile
5
from PIL import Image
6
7
8
@pytest.fixture
9
def imagedata():
10
    img = Image.new('RGB', (250, 250), (255, 55, 255))
11
12
    output = io.BytesIO()
13
    img.save(output, format='JPEG')
14
15
    return output
16
17
18
@pytest.fixture
19
def image_upload_file(imagedata):
20
    return SimpleUploadedFile(
21
        'testfile.jpg',
22
        imagedata.getvalue()
23
    )
24