コード例 #1
0
 def test_media_io_base_upload_streamable(self):
     fd = BytesIO(b'stuff')
     upload = MediaIoBaseUpload(fd=fd,
                                mimetype='image/png',
                                chunksize=500,
                                resumable=True)
     self.assertEqual(True, upload.has_stream())
     self.assertEqual(fd, upload.stream())
コード例 #2
0
  def test_media_io_base_upload_streamable(self):
    try:
      import io

      fd = io.BytesIO('stuff')
      upload = MediaIoBaseUpload(
          fd=fd, mimetype='image/png', chunksize=500, resumable=True)
      self.assertEqual(True, upload.has_stream())
      self.assertEqual(fd, upload.stream())
    except ImportError:
      pass
コード例 #3
0
 def test_media_io_base_upload_streamable(self):
   fd = BytesIO(b'stuff')
   upload = MediaIoBaseUpload(
       fd=fd, mimetype='image/png', chunksize=500, resumable=True)
   self.assertEqual(True, upload.has_stream())
   self.assertEqual(fd, upload.stream())