basic task order pdf downloads

This commit is contained in:
dandds
2018-09-05 17:45:12 -04:00
parent e8aa905a99
commit 0391348b5d
6 changed files with 81 additions and 5 deletions

View File

@@ -31,3 +31,19 @@ def test_upload_fails_for_non_pdfs(uploader):
fs = FileStorage(fp, content_type="text/plain")
with pytest.raises(UploadError):
uploader.upload(fs)
def test_download_stream(upload_dir, uploader, pdf_upload):
# write pdf content to upload file storage and make sure it is flushed to
# disk
pdf_upload.seek(0)
pdf_content = pdf_upload.read()
pdf_upload.close()
full_path = os.path.join(upload_dir, "abc")
with open(full_path, "wb") as output_file:
output_file.write(pdf_content)
output_file.flush()
stream = uploader.download_stream("abc")
stream_content = b"".join([b for b in stream])
assert pdf_content == stream_content