def test_expose_blob_download_with_legacy_download_id(self): self.db.put(BytesIO(b'legacy-blob'), self.identifier) ref = BlobDownload( self.identifier, mimetype='text/plain', content_disposition='text/xml', ) ref.download_id = uuid4().hex # old download id format ref.save(60) response = BlobDownload.get(ref.download_id).toHttpResponse() self.assertEqual(next(response.streaming_content), 'legacy-blob')
def expose_blob_download(identifier, expiry, mimetype='text/plain', content_disposition=None, download_id=None): """ Expose a blob object for download """ # TODO add file parameter and refactor blob_db.put(...) into this method ref = BlobDownload( identifier, mimetype=mimetype, content_disposition=content_disposition, download_id=download_id, ) ref.save(expiry) return ref
def expose_blob_download( identifier, expiry, mimetype='text/plain', content_disposition=None, download_id=None): """ Expose a blob object for download """ # TODO add file parameter and refactor blob_db.put(...) into this method ref = BlobDownload( identifier, mimetype=mimetype, content_disposition=content_disposition, download_id=download_id, ) ref.save(expiry) return ref