Skip to content

Commit

Permalink
Removed check for duplicate file name being blocked from uploaded as …
Browse files Browse the repository at this point in the history
…supporting evidence to an analysis. Also changed the system test to check if files with duplicate names get uploaded to the same analysis (#130)
  • Loading branch information
JmScherer authored Aug 23, 2023
1 parent 93a58d3 commit 5899ee8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions backend/src/routers/analysis_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions system-tests/e2e/case_supporting_evidence.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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', () => {
Expand Down

0 comments on commit 5899ee8

Please sign in to comment.