def test_blob_rest_data_headers_unicode(self): import ptahcms from ptahcms.rest import blobData blob = ptahcms.blob_storage.add(BytesIO(bytes_('blob data', 'utf-8')), filename='test.jpg', mimetype=text_type('image/jpeg')) response = blobData(blob, self.request) headers = response.headers for hdr in headers: if hdr.lower() != 'content-length': self.assertTrue(isinstance(headers[hdr], binary_type))
def test_blob_rest_data_headers_unicode(self): import ptahcms from ptahcms.rest import blobData blob = ptahcms.blob_storage.add( BytesIO(bytes_('blob data','utf-8')), filename='test.jpg', mimetype=text_type('image/jpeg')) response = blobData(blob, self.request) headers = response.headers for hdr in headers: if hdr.lower() != 'content-length': self.assertTrue(isinstance(headers[hdr], binary_type))
def test_blob_rest_data(self): import ptahcms from ptahcms.rest import blobData blob = ptahcms.blob_storage.add(BytesIO(bytes_('blob data', 'utf-8')), filename='test.txt', mimetype='text/plain') response = blobData(blob, self.request) self.assertEqual(response.body, bytes_('blob data', 'utf-8')) self.assertEqual( response.headerlist, [('Content-Type', bytes_('text/plain')), ('Content-Disposition', bytes_('filename="test.txt"', 'utf-8')), ('Content-Length', '9')])
def test_blob_rest_data(self): import ptahcms from ptahcms.rest import blobData blob = ptahcms.blob_storage.add( BytesIO(bytes_('blob data','utf-8')), filename='test.txt', mimetype='text/plain') response = blobData(blob, self.request) self.assertEqual(response.body, bytes_('blob data','utf-8')) self.assertEqual( response.headerlist, [('Content-Type', bytes_('text/plain')), ('Content-Disposition', bytes_('filename="test.txt"','utf-8')), ('Content-Length', '9')])