diff --git a/atst/domain/csp/file_uploads.py b/atst/domain/csp/file_uploads.py index 57ea8f0e..80d6cb70 100644 --- a/atst/domain/csp/file_uploads.py +++ b/atst/domain/csp/file_uploads.py @@ -29,6 +29,10 @@ class MockUploader(Uploader): self.config = config def get_token(self): + """ + Generates a pre-authenticated token and object name which we'll use to + upload the file to the CSP. + """ return ({}, self.object_name()) @@ -38,12 +42,13 @@ class AzureUploader(Uploader): def get_token(self): account = CloudStorageAccount( - account_name="atat", account_key=self.config["AZURE_STORAGE_KEY"] + account_name=self.config["AZURE_ACCOUNT_NAME"], + account_key=self.config["AZURE_STORAGE_KEY"], ) bbs = account.create_block_blob_service() object_name = self.object_name() sas_token = bbs.generate_container_shared_access_signature( - "task-order-pdfs", + self.config["AZURE_TO_BUCKET_NAME"], ContainerPermissions.WRITE, datetime.utcnow() + timedelta(minutes=15), ) diff --git a/js/components/__tests__/checkbox_input.test.js b/js/components/__tests__/checkbox_input.test.js index e7d0fb5a..4c6b15f8 100644 --- a/js/components/__tests__/checkbox_input.test.js +++ b/js/components/__tests__/checkbox_input.test.js @@ -11,7 +11,7 @@ const WrapperComponent = makeTestWrapper({ templatePath: 'checkbox_input_template.html', data: function() { return { initialvalue: this.initialData } - } + }, }) describe('CheckboxInput Renders Correctly', () => { diff --git a/js/components/__tests__/upload_input.test.js b/js/components/__tests__/upload_input.test.js index 7022ce41..c867eea3 100644 --- a/js/components/__tests__/upload_input.test.js +++ b/js/components/__tests__/upload_input.test.js @@ -9,7 +9,7 @@ const UploadWrapper = makeTestWrapper({ templatePath: 'upload_input_template.html', data: function() { return { initialvalue: this.initialData.initialvalue, token: this.token } - } + }, }) const UploadErrorWrapper = makeTestWrapper({ @@ -17,14 +17,14 @@ const UploadErrorWrapper = makeTestWrapper({ templatePath: 'upload_input_error_template.html', data: function() { return { initialvalue: null, token: null } - } + }, }) describe('UploadInput Test', () => { it('should show input and button when no attachment present', () => { const wrapper = mount(UploadWrapper, { propsData: { - initialData: { initialvalue: null, token: "token" }, + initialData: { initialvalue: null, token: 'token' }, }, }) @@ -35,7 +35,7 @@ describe('UploadInput Test', () => { it('should show file name and hide input', () => { const wrapper = mount(UploadWrapper, { propsData: { - initialData: { initialvalue: "somepdf.pdf", token: "token" } + initialData: { initialvalue: 'somepdf.pdf', token: 'token' }, }, }) @@ -49,8 +49,8 @@ describe('UploadInput Test', () => { it('should correctly display error treatment', () => { const wrapper = mount(UploadErrorWrapper, { propsData: { - initialData: { initialvalue: "somepdf.pdf", token: "token" } - } + initialData: { initialvalue: 'somepdf.pdf', token: 'token' }, + }, }) const messageArea = wrapper.find('.usa-input__message') diff --git a/tests/render_vue_component.py b/tests/render_vue_component.py index c09f6eb2..b502ea93 100644 --- a/tests/render_vue_component.py +++ b/tests/render_vue_component.py @@ -74,11 +74,15 @@ def test_make_checkbox_input_template(checkbox_input_macro, initial_value_form): def test_make_upload_input_template(upload_input_macro, task_order_form): - rendered_upload_macro = upload_input_macro(task_order_form.pdf, token="token", object_name="object_name") + rendered_upload_macro = upload_input_macro( + task_order_form.pdf, token="token", object_name="object_name" + ) write_template(rendered_upload_macro, "upload_input_template.html") def test_make_upload_input_error_template(upload_input_macro, task_order_form): task_order_form.validate() - rendered_upload_macro = upload_input_macro(task_order_form.pdf, token="token", object_name="object_name") + rendered_upload_macro = upload_input_macro( + task_order_form.pdf, token="token", object_name="object_name" + ) write_template(rendered_upload_macro, "upload_input_error_template.html")