Пример #1
0
 def test_mime_file_container(self):
     """Test Request._build_mime_request encodes binary."""
     local_filename = os.path.join(_images_dir, "MP_sounds.png")
     with open(local_filename, "rb") as f:
         file_content = f.read()
     body = Request._build_mime_request(
         {}, {"file": (file_content, ("image", "png"), {"filename": local_filename})}
     )[1]
     self.assertNotEqual(body.find(file_content), -1)
Пример #2
0
 def test_mime_file_container(self):
     local_filename = os.path.join(_data_dir, 'MP_sounds.png')
     with open(local_filename, 'rb') as f:
         file_content = f.read()
     body = Request._build_mime_request({}, {
         'file': (file_content, ('image', 'png'),
                  {'filename': local_filename})
     })[1]
     self.assertNotEqual(body.find(file_content), -1)
Пример #3
0
 def test_mime_file_container(self):
     """Test Request._build_mime_request encodes binary."""
     local_filename = join_images_path('MP_sounds.png')
     with open(local_filename, 'rb') as f:
         file_content = f.read()
     body = Request._build_mime_request({}, {
         'file': (file_content, ('image', 'png'),
                  {'filename': local_filename})
     })[1]
     self.assertNotEqual(body.find(file_content), -1)
Пример #4
0
 def test_mime_file_container(self):
     """Test Request._build_mime_request encodes binary."""
     local_filename = join_images_path('MP_sounds.png')
     with open(local_filename, 'rb') as f:
         file_content = f.read()
     body = Request._build_mime_request({}, {
         'file': (file_content, ('image', 'png'),
                  {'filename': local_filename})
     })[1]
     self.assertNotEqual(body.find(file_content), -1)