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:
dandds
2019-08-08 13:20:27 -04:00
parent 334a280610
commit 9fc6514d80
13 changed files with 39 additions and 292 deletions

View File

@@ -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)

View File

@@ -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