test(qqbot): update voice detection tests for content_type-only logic
Update TestIsVoiceContentType to match the new behavior: - Empty content_type with audio extensions → False (no sniffing) - File upload with audio extension → False - Added test_file_upload_with_audio_extension for the reported bug case
This commit is contained in:
@@ -139,14 +139,21 @@ class TestIsVoiceContentType:
|
||||
def test_audio_content_type(self):
|
||||
assert self._fn("audio/mp3", "file.mp3") is True
|
||||
|
||||
def test_voice_extension(self):
|
||||
assert self._fn("", "file.silk") is True
|
||||
def test_voice_extension_ignored_when_content_type_empty(self):
|
||||
"""content_type='' with audio extension → False (no extension sniffing)."""
|
||||
assert self._fn("", "file.silk") is False
|
||||
|
||||
def test_non_voice(self):
|
||||
assert self._fn("image/jpeg", "photo.jpg") is False
|
||||
|
||||
def test_audio_extension_amr(self):
|
||||
assert self._fn("", "recording.amr") is True
|
||||
def test_audio_extension_amr_ignored_when_content_type_empty(self):
|
||||
"""content_type='' with .amr extension → False (no extension sniffing)."""
|
||||
assert self._fn("", "recording.amr") is False
|
||||
|
||||
def test_file_upload_with_audio_extension(self):
|
||||
"""File upload with audio extension must NOT be treated as voice."""
|
||||
assert self._fn("file", "song.mp3") is False
|
||||
assert self._fn("file", "audio-30251.instrumental..wav") is False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user