On Jan 24, 2:45 am, varikin <vari...@gmail.com> wrote:
> The UploadedFile[1] object has a field called content_type. So if you
> have this in a form:
>
> myfile = request.FILES['some_file']
> if myfile.content_type != 'application/zip':
>      #raise error
>
> I don't know if this will help you in your test. I hope it does.
>
> [1]http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload...
>
> John

Hi John,

Thanks for your reply. The snippet you've given is the kind of things
my view already does. The problem is that, when testing with
self.client.post(), all files are systematically encoded as
'application/octet-stream'. To test the behaviour of my view I need to
control the content type of each uploaded files. And it doesn't seem
like there's another way than creating a custom request from scratch
to achieve that. Is that correct?

Thanks,

Julien
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to