Clean up defunct upload and CRL logic.
- Applies our previous CSP namespacing pattern to the upload classes. - Removes code and config for previous uploader implementation. - Removes Attachment model's ability to upload files directly and adjusts tests that expected that behavior.
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
import pytest
|
||||
from werkzeug.datastructures import FileStorage
|
||||
|
||||
from atst.models.attachment import Attachment, AttachmentError
|
||||
|
||||
from tests.mocks import PDF_FILENAME
|
||||
|
||||
|
||||
def test_attach(pdf_upload):
|
||||
attachment = Attachment.attach(pdf_upload)
|
||||
assert attachment.filename == PDF_FILENAME
|
||||
assert attachment.object_name is not None
|
||||
|
||||
|
||||
def test_attach_raises():
|
||||
with open(PDF_FILENAME, "rb") as fp:
|
||||
fs = FileStorage(fp, content_type="something/else")
|
||||
with pytest.raises(AttachmentError):
|
||||
Attachment.attach(fs)
|
||||
|
||||
|
||||
def test_repr(pdf_upload):
|
||||
attachment = Attachment.attach(pdf_upload)
|
||||
assert attachment.filename in str(attachment)
|
||||
assert str(attachment.id) in str(attachment)
|
@@ -157,12 +157,9 @@ class TestPDF:
|
||||
|
||||
assert to.pdf_attachment_id == attachment.id
|
||||
|
||||
def test_setting_pdf_with_file_storage(self):
|
||||
def test_setting_pdf_with_dictionary(self):
|
||||
to = TaskOrder()
|
||||
with open(PDF_FILENAME, "rb") as fp:
|
||||
fs = FileStorage(fp, content_type="application/pdf")
|
||||
to.pdf = fs
|
||||
|
||||
to.pdf = {"filename": PDF_FILENAME, "object_name": "123456"}
|
||||
assert to.pdf is not None
|
||||
assert to.pdf.filename == PDF_FILENAME
|
||||
|
||||
|
Reference in New Issue
Block a user