title: Pytest - send image in nested object
body: <p>I've got an endpoint that receives a form data, where one of the keys is an array of objects that contain an image.</p>
  <p>I'm trying to make the following test for the endpoint</p>
  <pre><code>file_horizontal = BytesIO()
  image_horizontal = Image.new('RGBA', size=(244, 100), color=(155, 0, 0))
  image_horizontal.save(file_horizontal, 'png')
  file_horizontal.name = 'teste_horizontal.png'
  file_horizontal.seek(0)
  
  file_vertical = BytesIO()
  image_vertical = Image.new('RGBA', size=(138, 100), color=(155, 0, 0))
  image_vertical.save(file_vertical, 'png')
  file_vertical.name = 'teste_vertical.png'
  file_vertical.seek(0)
  
  self.data = {
      'part_id': 123
      'logo': [
          {
              'logo_type': 'HORIZONTAL',
              'document_type': [1, 2],
              'image': file_horizontal
          },
          {
              'logo_type': 'VERTICAL',
              'document_type': [3, 4],
              'image': file_vertical
          },
      ]
  }
  
  def test_diff_create(self):
      response = self.client.post(self.url_create, self.data, format='multipart', HTTP_ACCEPT='application/json; version=1.0')
  
      self.assertEqual(response.status_code, status.HTTP_201_CREATED)
  </code></pre>
  <p>This way, the endpoint receives the logo data as  <code>&quot;{'logo_type': 'VERTICAL', 'document_type': [3, 4], 'image': &lt;_io.BytesIO object at 0x7fc4deadf8b0&gt;}&quot;</code></p>
  <p>The logo data is not sent as an array, and it only sends the last object of the array. In json format, the data is sent as an array, but I can not send the images in json because they are not json serializable.</p>
  <p>The endpoint expects to receive an array like this</p>
  <pre><code>[{'logo_type': 'HORIZONTAL', 'document_type': [1, 2], 'image': &lt;InMemoryUploadedFile: test_horizontal.png (image/png)&gt;}, {'logo_type': 'VERTICAL', 'document_type': [3, 4], 'image': &lt;InMemoryUploadedFile: test_vertical.png (image/png)&gt;}]
  </code></pre>