I have something like this:
def upload_something(request):
    data = {}
    if request.FILES:
        raw_file = request.FILES['myfile'].read()
    else:
        raw_file = request.raw_post_data
I can't seem to be able to write a unit-test that populates raw_post_data, how would I go about doing that? I basically just want to send an image file. I'm trying to create a test case for when I read raw_post_data and it errors with:
You cannot access raw_post_data after reading from request's data stream
 
     
     
     
     
    