feat: delete with provider validation#592
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds optional provider validation to the video-transcript DELETE endpoint. When a provider parameter is supplied, the endpoint validates that it matches the existing transcript's provider before deletion, returning a 404 error if there's a mismatch.
- Added optional
providerquery parameter to the DELETE endpoint for additional validation - Created new
TranscriptNotFoundErrorexception for provider mismatch scenarios - Updated the
delete_video_transcriptAPI function to accept and validate the provider parameter
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| edxval/views.py | Added provider parameter extraction and TranscriptNotFoundError handling in DELETE endpoint |
| edxval/api.py | Enhanced delete_video_transcript function with optional provider validation logic |
| edxval/exceptions.py | Introduced new TranscriptNotFoundError exception class |
| edxval/tests/test_views.py | Added test cases for provider validation scenarios and updated existing tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #592 +/- ##
==========================================
+ Coverage 94.81% 94.84% +0.03%
==========================================
Files 33 33
Lines 3315 3337 +22
Branches 127 128 +1
==========================================
+ Hits 3143 3165 +22
Misses 154 154
Partials 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This is a way to more safely call deletion of a transcript: If the provider does not match the supplied provider do not move forward with deletion of the transcript.
Have I mentioned that we need to add an auto-formatter? It is insane to break on quality failure without an opinionated way to auto-format.
219988c to
2a51452
Compare
Adds an optional
providerparam for thevideo-transcriptDELETEendpoint for additional validation.For backwards compatibility, this is optional: where omitted, the delete endpoint operates as previously defined and, whether found or not, returns a
204.HTTP/1.1 204 No ContentWhere provided (pun intended), the
providerparam checks that the givenprovidermatches that of the identified transcript, failing with a404.