From 5899ee86eea8b325abdd60ca6b0f98d7ba8c87d3 Mon Sep 17 00:00:00 2001 From: James Scherer Date: Wed, 23 Aug 2023 10:52:17 -0500 Subject: [PATCH] Removed check for duplicate file name being blocked from uploaded as supporting evidence to an analysis. Also changed the system test to check if files with duplicate names get uploaded to the same analysis (#130) --- backend/src/routers/analysis_router.py | 2 -- system-tests/e2e/case_supporting_evidence.cy.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/routers/analysis_router.py b/backend/src/routers/analysis_router.py index f7c785eb..5f3b9e73 100644 --- a/backend/src/routers/analysis_router.py +++ b/backend/src/routers/analysis_router.py @@ -213,8 +213,6 @@ def attach_supporting_evidence_file( analysis_name: str, upload_file: UploadFile = File(...), comments: str = Form(...), repositories=Depends(database) ): """Uploads a file to GridFS and adds it to the analysis""" - if bool(repositories["analysis"].find_file_by_name(analysis_name, upload_file.filename)): - raise HTTPException(status_code=409, detail="File with the same name already exists in the given analysis") new_file_object_id = repositories['bucket'].save_file( upload_file.file, upload_file.filename, upload_file.content_type diff --git a/system-tests/e2e/case_supporting_evidence.cy.js b/system-tests/e2e/case_supporting_evidence.cy.js index 7570f3ae..4d9e9690 100644 --- a/system-tests/e2e/case_supporting_evidence.cy.js +++ b/system-tests/e2e/case_supporting_evidence.cy.js @@ -151,7 +151,7 @@ describe('case_supporting_evidence.cy.js', () => { cy.get('.attachment-list').should('have.length', 0); }); - it('should fail to attach the same supporting evidence file twice to the same analysis', () => { + it('should be able to attach the same supporting evidence file twice to the same analysis', () => { cy.get('#Supporting_Evidence').should('exist'); cy.get('.attachment-list').should('have.length', 0); cy.get('[data-test="add-button"]').click(); @@ -172,7 +172,7 @@ describe('case_supporting_evidence.cy.js', () => { }); cy.get('.comments').type('this is a test comment for a test file'); cy.get('[data-test="confirm"]').click(); - cy.get('.attachment-list').should('have.length', 1); + cy.get('.attachment-list').should('have.length', 2); }); it('should be able to attach the same supporting evidence file to different analyses', () => {