In my django app, I have a view which accomplishes file upload.The core snippet is like this
... if (request.method == \'POST\'): if request.FILES.has_
from django.test import Client from requests import Response client = Client() with open(template_path, 'rb') as f: file = SimpleUploadedFile('Name of the django file', f.read()) response: Response = client.post(url, format='multipart', data={'file': file})
Hope this helps.