# 상담 신청서 업로드 test
def test_photo_add(self):
photo_file = self.generate_photo_file()
url = '/abcdefg/'
data={
'image_file': photo_file
}
response= self.client.post(url,data,format='multipart')
self.assertEqual(response.status_code,200)
def generate_photo_file(self):
file = io.BytesIO()
image = Image.new('RGBA', size=(100, 100), color=(155, 0, 0))
image.save(file, 'png')
file.name = 'test.png'
file.seek(0)
return file
'Django' 카테고리의 다른 글
docker -compose up -bulid 에서 오류 (0) | 2020.12.12 |
---|---|
Django 에서 venv 에 있는 lib 파일들을 수정해야할 때 (0) | 2020.12.12 |
rest-auth / login 의 응답값 수정하기 (0) | 2020.12.12 |
[TDD] Serializer 테스트 (0) | 2020.11.27 |
415 에러 (0) | 2020.11.26 |