From df55fb2424a8c3765b3ee4057ccd79b655193a8b Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 23 Apr 2025 11:29:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(backend)=20rename=20copy-pasted=20?= =?UTF-8?q?unit=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix inconsistent test naming resulting from copy-pasted examples. Rename tests to properly reflect their actual testing purpose and improve code maintainability. --- .../test_api_recordings_media_auth.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/backend/core/tests/recording/test_api_recordings_media_auth.py b/src/backend/core/tests/recording/test_api_recordings_media_auth.py index 3a860fbf..51917632 100644 --- a/src/backend/core/tests/recording/test_api_recordings_media_auth.py +++ b/src/backend/core/tests/recording/test_api_recordings_media_auth.py @@ -20,7 +20,7 @@ from core.factories import RecordingFactory, UserFactory, UserRecordingAccessFac pytestmark = pytest.mark.django_db -def test_api_documents_media_auth_unauthenticated(): +def test_api_recordings_media_auth_unauthenticated(): """ Test that unauthenticated requests to download media are rejected """ @@ -33,7 +33,7 @@ def test_api_documents_media_auth_unauthenticated(): assert response.status_code == 401 -def test_api_documents_media_auth_wrong_path(): +def test_api_recordings_media_auth_wrong_path(): """ Test that media URLs with incorrect path structures are rejected """ @@ -51,7 +51,7 @@ def test_api_documents_media_auth_wrong_path(): assert response.status_code == 403 -def test_api_documents_media_auth_unknown_recording(): +def test_api_recordings_media_auth_unknown_recording(): """ Test that requests for non-existent recordings are properly handled """ @@ -69,7 +69,7 @@ def test_api_documents_media_auth_unknown_recording(): assert response.status_code == 404 -def test_api_documents_media_auth_no_abilities(): +def test_api_recordings_media_auth_no_abilities(): """ Test that users without any access permissions cannot download recordings """ @@ -88,7 +88,7 @@ def test_api_documents_media_auth_no_abilities(): assert response.status_code == 403 -def test_api_documents_media_auth_wrong_abilities(): +def test_api_recordings_media_auth_wrong_abilities(): """ Test that users with insufficient role permissions cannot download recordings """ @@ -111,7 +111,7 @@ def test_api_documents_media_auth_wrong_abilities(): @pytest.mark.parametrize("wrong_status", ["initiated", "active", "failed_to_stop"]) -def test_api_documents_media_auth_unsaved(wrong_status): +def test_api_recordings_media_auth_unsaved(wrong_status): """ Test that recordings that aren't in 'saved' status cannot be downloaded """ @@ -132,7 +132,7 @@ def test_api_documents_media_auth_unsaved(wrong_status): assert response.status_code == 403 -def test_api_documents_media_auth_mismatched_extension(): +def test_api_recordings_media_auth_mismatched_extension(): """ Test that requests with mismatched file extensions are rejected """ @@ -160,7 +160,7 @@ def test_api_documents_media_auth_mismatched_extension(): @pytest.mark.parametrize( "wrong_extension", ["jpg", "txt", "mp3"], ids=["image", "text", "audio"] ) -def test_api_documents_media_auth_wrong_extension(wrong_extension): +def test_api_recordings_media_auth_wrong_extension(wrong_extension): """ Trying to download a recording with an unsupported extension should return a validation error (400) with details about allowed extensions. @@ -185,7 +185,7 @@ def test_api_documents_media_auth_wrong_extension(wrong_extension): @pytest.mark.parametrize("mode", ["screen_recording", "transcript"]) -def test_api_documents_media_auth_success_owner(mode): +def test_api_recordings_media_auth_success_owner(mode): """ Test downloading a recording when logged in and authorized. Verifies S3 authentication headers and successful file retrieval. @@ -235,7 +235,7 @@ def test_api_documents_media_auth_success_owner(mode): @pytest.mark.parametrize("mode", ["screen_recording", "transcript"]) -def test_api_documents_media_auth_success_administrator(mode): +def test_api_recordings_media_auth_success_administrator(mode): """ Test downloading a recording when logged in and authorized. Verifies S3 authentication headers and successful file retrieval.