Seek to beginning of file before writing
Not seeking was providing files of 0 bytes. Not sure why this just recently started breaking.
This commit is contained in:
parent
6a9290619d
commit
30be2a5018
@ -57,6 +57,7 @@ class RackspaceFileProvider(FileProviderInterface):
|
|||||||
object_name = uuid4().hex
|
object_name = uuid4().hex
|
||||||
with NamedTemporaryFile() as tempfile:
|
with NamedTemporaryFile() as tempfile:
|
||||||
tempfile.write(fyle.stream.read())
|
tempfile.write(fyle.stream.read())
|
||||||
|
tempfile.seek(0)
|
||||||
self.container.upload_object(
|
self.container.upload_object(
|
||||||
file_path=tempfile.name,
|
file_path=tempfile.name,
|
||||||
object_name=object_name,
|
object_name=object_name,
|
||||||
|
@ -44,3 +44,14 @@ def test_download(app, uploader, pdf_upload):
|
|||||||
stream = uploader.download("abc")
|
stream = uploader.download("abc")
|
||||||
stream_content = b"".join([b for b in stream])
|
stream_content = b"".join([b for b in stream])
|
||||||
assert pdf_content == stream_content
|
assert pdf_content == stream_content
|
||||||
|
|
||||||
|
|
||||||
|
def test_downloading_uploaded_object(uploader, pdf_upload):
|
||||||
|
object_name = uploader.upload(pdf_upload)
|
||||||
|
stream = uploader.download(object_name)
|
||||||
|
stream_content = b"".join([b for b in stream])
|
||||||
|
|
||||||
|
pdf_upload.seek(0)
|
||||||
|
pdf_content = pdf_upload.read()
|
||||||
|
|
||||||
|
assert stream_content == pdf_content
|
||||||
|
Loading…
x
Reference in New Issue
Block a user