[AudioController] Clean up methods and add tests#3841
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3841 +/- ##
==========================================
+ Coverage 73.24% 73.34% +0.09%
==========================================
Files 286 286
Lines 10751 10750 -1
Branches 1341 1341
==========================================
+ Hits 7875 7885 +10
+ Misses 2479 2471 -8
+ Partials 397 394 -3
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:
|
| [Test] | ||
| public void TestUploadAudioFileNoWord() | ||
| { | ||
| var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result; |
There was a problem hiding this comment.
I believe this was the intention.
| var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result; | |
| var result = _audioController.UploadAudioFile(_projId, "not-a-word", _file).Result; |
| var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result; | ||
| Assert.That(result, Is.InstanceOf<NotFoundObjectResult>()); | ||
|
|
||
| result = _audioController.UploadAudioFile(_projId, "not-a-user", "speakerId", _file).Result; |
There was a problem hiding this comment.
| result = _audioController.UploadAudioFile(_projId, "not-a-user", "speakerId", _file).Result; | |
| result = _audioController.UploadAudioFile(_projId, "not-a-word", "speakerId", _file).Result; |
| { | ||
| var result = _audioController.DownloadAudioFile("invalid/projId", "wordId", "fileName"); | ||
| var result = _audioController.DownloadAudioFile("invalid/projId", "fileName"); | ||
| Assert.That(result, Is.TypeOf<UnsupportedMediaTypeResult>()); |
There was a problem hiding this comment.
Just because all this code is so new to me and intriguing:
UnsupportedMediaType feels a bit confusing as a response type for invalid string identifiers. I'd expect a boring 400 with a message.
There was a problem hiding this comment.
Boring 400 perhaps makes more sense. I'm leaving it for now to be evaluated in all the controllers at the same time.
DownloadAudioFile: removes unused wordId paramUploadAudioFile: verifies word exists before copying the fileProducesResponseTypeattributesThis change is