Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSEGOG-321 Fully implement delete records #140

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

MRichards99
Copy link
Collaborator

This PR adds full implementation to the DELETE /records/{_id} endpoint by deleting images and waveforms stored on Echo. Previously, the record would be removed from the database but images & waveforms associated with that record would still be stored in Echo.

To do this, a new function has been added to the EchoInterface class, delete_directory(). This allows all of the images or all of the waveforms for a particular record to be removed in one call (two calls total, one for images, one for waveforms). This function is called in the entrypoint function for the DELETE /records/{_id} endpoint. I've added tests for this new code.

I fixed a bug occurring with some of the tests in 95321ba as I noticed images and waveforms weren't being deleted for a particular record ID. In e7ca92f, I improved the integration test for DELETE /records/{_id} endpoint by moving the setup and teardown into the fixture (it was in the test itself before).

…eletion

- I've moved the setup & teardown of the data into a fixture and added an image and waveform channel
- `record` can be a `RecordModel` or a dictionary (whose contents will be put into a `RecordModel` in the init)
…s and images on teardown

- I noticed a bug where after running the tests in `test_submit_hdf.py`, images and waveforms for `20200407142816` wouldn't be deleted from Echo
- The fixture was trying to remove waveforms from the database so it was obvious that wasn't going to work
- Deletion of images wasn't working because `images/` wasn't being prefixed to the path, meaning the files couldn't be found and therefore deleted
- Renamed fixture from `reset_databases()` to `reset_record_storage()` - this seems to be a more appropriate name for what the function is doing
- I've added some comments in the test and the docstring of the source code to indicate the check and why it's being mocked in the test
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.63%. Comparing base (01cd923) to head (d94fa1e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
+ Coverage   95.61%   95.63%   +0.01%     
==========================================
  Files          72       72              
  Lines        3719     3733      +14     
  Branches      383      383              
==========================================
+ Hits         3556     3570      +14     
  Misses        113      113              
  Partials       50       50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant