Formatting
This commit is contained in:
parent
4f9e7c3408
commit
cfe9b7589e
11
atst/app.py
11
atst/app.py
@ -146,11 +146,12 @@ def make_crl_validator(app):
|
|||||||
def make_eda_client(app):
|
def make_eda_client(app):
|
||||||
app.eda_client = MockEDAClient()
|
app.eda_client = MockEDAClient()
|
||||||
|
|
||||||
|
|
||||||
def make_upload_storage(app):
|
def make_upload_storage(app):
|
||||||
uploader = Uploader(
|
uploader = Uploader(
|
||||||
provider=app.config.get("STORAGE_PROVIDER"),
|
provider=app.config.get("STORAGE_PROVIDER"),
|
||||||
container=app.config.get("STORAGE_CONTAINER"),
|
container=app.config.get("STORAGE_CONTAINER"),
|
||||||
key=app.config.get("STORAGE_KEY"),
|
key=app.config.get("STORAGE_KEY"),
|
||||||
secret=app.config.get("STORAGE_SECRET")
|
secret=app.config.get("STORAGE_SECRET"),
|
||||||
)
|
)
|
||||||
app.uploader = uploader
|
app.uploader = uploader
|
||||||
|
@ -251,7 +251,9 @@ WHERE requests_with_status.status = :status
|
|||||||
else:
|
else:
|
||||||
task_order_number = request_data.get("task_order_number")
|
task_order_number = request_data.get("task_order_number")
|
||||||
|
|
||||||
if "task_order" in request_data and isinstance(request_data["task_order"], FileStorage):
|
if "task_order" in request_data and isinstance(
|
||||||
|
request_data["task_order"], FileStorage
|
||||||
|
):
|
||||||
task_order_data["pdf"] = request_data.pop("task_order")
|
task_order_data["pdf"] = request_data.pop("task_order")
|
||||||
|
|
||||||
task_order = TaskOrders.get_or_create_task_order(
|
task_order = TaskOrders.get_or_create_task_order(
|
||||||
|
@ -58,5 +58,8 @@ class TaskOrders(object):
|
|||||||
# should catch the error here
|
# should catch the error here
|
||||||
attachment = Attachment.attach(pdf_file)
|
attachment = Attachment.attach(pdf_file)
|
||||||
return TaskOrders.create(
|
return TaskOrders.create(
|
||||||
**task_order_data, number=number, source=Source.MANUAL, pdf=attachment
|
**task_order_data,
|
||||||
|
number=number,
|
||||||
|
source=Source.MANUAL,
|
||||||
|
pdf=attachment,
|
||||||
)
|
)
|
||||||
|
@ -216,4 +216,7 @@ class ExtendedFinancialForm(BaseFinancialForm):
|
|||||||
filters=[number_to_int],
|
filters=[number_to_int],
|
||||||
)
|
)
|
||||||
|
|
||||||
task_order = FileField("Upload a copy of your Task Order", validators=[FileAllowed(['pdf'], 'Only PDF documents can be uploaded.')])
|
task_order = FileField(
|
||||||
|
"Upload a copy of your Task Order",
|
||||||
|
validators=[FileAllowed(["pdf"], "Only PDF documents can be uploaded.")],
|
||||||
|
)
|
||||||
|
@ -30,7 +30,6 @@ def update_financial_verification(request_id):
|
|||||||
post_data = http_request.form
|
post_data = http_request.form
|
||||||
existing_request = Requests.get(request_id)
|
existing_request = Requests.get(request_id)
|
||||||
form = financial_form(post_data)
|
form = financial_form(post_data)
|
||||||
|
|
||||||
rerender_args = dict(
|
rerender_args = dict(
|
||||||
request_id=request_id, f=form, extended=http_request.args.get("extended")
|
request_id=request_id, f=form, extended=http_request.args.get("extended")
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ class UploadError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Uploader():
|
class Uploader:
|
||||||
_PERMITTED_MIMETYPES = ["application/pdf"]
|
_PERMITTED_MIMETYPES = ["application/pdf"]
|
||||||
|
|
||||||
def __init__(self, provider, container=None, key=None, secret=None):
|
def __init__(self, provider, container=None, key=None, secret=None):
|
||||||
|
@ -26,7 +26,6 @@ def app(request):
|
|||||||
ctx = _app.app_context()
|
ctx = _app.app_context()
|
||||||
ctx.push()
|
ctx.push()
|
||||||
|
|
||||||
|
|
||||||
yield _app
|
yield _app
|
||||||
|
|
||||||
upload_dir.cleanup()
|
upload_dir.cleanup()
|
||||||
|
@ -13,4 +13,3 @@ MOCK_VALID_PE_ID = "8675309U"
|
|||||||
FIXTURE_EMAIL_ADDRESS = "artgarfunkel@uso.mil"
|
FIXTURE_EMAIL_ADDRESS = "artgarfunkel@uso.mil"
|
||||||
|
|
||||||
PDF_FILENAME = "tests/fixtures/sample.pdf"
|
PDF_FILENAME = "tests/fixtures/sample.pdf"
|
||||||
|
|
||||||
|
@ -31,4 +31,3 @@ def test_upload_fails_for_non_pdfs(uploader):
|
|||||||
fs = FileStorage(fp, content_type="text/plain")
|
fs = FileStorage(fp, content_type="text/plain")
|
||||||
with pytest.raises(UploadError):
|
with pytest.raises(UploadError):
|
||||||
uploader.upload(fs)
|
uploader.upload(fs)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user