diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-20 16:40:28 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-20 16:40:28 +0200 |
| commit | bdf93cbc700f6baa55a283300d5bd3d2e958bc69 (patch) | |
| tree | 411459de7a546a6a214344bb1d9eb4e1bafb5405 /tests/cogs | |
| parent | Clean up consumers: replace polling with VoiceManager.play_source() (diff) | |
| download | senator-sperma-bdf93cbc700f6baa55a283300d5bd3d2e958bc69.tar.gz senator-sperma-bdf93cbc700f6baa55a283300d5bd3d2e958bc69.zip | |
Redirect play_commands imports to cogs.voice, remove audio_playback shim
- Update play_commands.py to import get_voice_manager from cogs.voice
instead of going through the audio_playback.py re-export shim
- Delete the audio_playback.py shim file entirely
- Update test_music_audio.py imports to use cogs.voice.VoiceManager
- Delete PLAN_VOICE_REFACTOR.md (plan is complete)
Diffstat (limited to 'tests/cogs')
| -rw-r--r-- | tests/cogs/test_music_audio.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/cogs/test_music_audio.py b/tests/cogs/test_music_audio.py index 150ad5d..98c6f6b 100644 --- a/tests/cogs/test_music_audio.py +++ b/tests/cogs/test_music_audio.py | |||
| @@ -6,7 +6,7 @@ from conftest import MockApplicationContext | |||
| 6 | 6 | ||
| 7 | @pytest.mark.asyncio | 7 | @pytest.mark.asyncio |
| 8 | async def test_validate_voice_channel_not_in_voice(): | 8 | async def test_validate_voice_channel_not_in_voice(): |
| 9 | from cogs.music.audio_playback import AudioPlaybackManager | 9 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 10 | 10 | ||
| 11 | mock_ctx = MagicMock() | 11 | mock_ctx = MagicMock() |
| 12 | mock_ctx.author.voice = None | 12 | mock_ctx.author.voice = None |
| @@ -20,7 +20,7 @@ async def test_validate_voice_channel_not_in_voice(): | |||
| 20 | 20 | ||
| 21 | @pytest.mark.asyncio | 21 | @pytest.mark.asyncio |
| 22 | async def test_validate_voice_channel_in_voice(): | 22 | async def test_validate_voice_channel_in_voice(): |
| 23 | from cogs.music.audio_playback import AudioPlaybackManager | 23 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 24 | 24 | ||
| 25 | mock_channel = MagicMock() | 25 | mock_channel = MagicMock() |
| 26 | mock_ctx = MagicMock() | 26 | mock_ctx = MagicMock() |
| @@ -35,7 +35,7 @@ async def test_validate_voice_channel_in_voice(): | |||
| 35 | 35 | ||
| 36 | @pytest.mark.asyncio | 36 | @pytest.mark.asyncio |
| 37 | async def test_prepare_file_source_file_not_found(): | 37 | async def test_prepare_file_source_file_not_found(): |
| 38 | from cogs.music.audio_playback import AudioPlaybackManager | 38 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 39 | 39 | ||
| 40 | display_name, absolute_path = await AudioPlaybackManager.prepare_file_source("/nonexistent/file.mp3") | 40 | display_name, absolute_path = await AudioPlaybackManager.prepare_file_source("/nonexistent/file.mp3") |
| 41 | 41 | ||
| @@ -45,7 +45,7 @@ async def test_prepare_file_source_file_not_found(): | |||
| 45 | 45 | ||
| 46 | @pytest.mark.asyncio | 46 | @pytest.mark.asyncio |
| 47 | async def test_prepare_file_source_absolute_path(): | 47 | async def test_prepare_file_source_absolute_path(): |
| 48 | from cogs.music.audio_playback import AudioPlaybackManager | 48 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 49 | 49 | ||
| 50 | with patch('os.path.exists', return_value=True): | 50 | with patch('os.path.exists', return_value=True): |
| 51 | with patch('os.path.isabs', return_value=True): | 51 | with patch('os.path.isabs', return_value=True): |
| @@ -57,7 +57,7 @@ async def test_prepare_file_source_absolute_path(): | |||
| 57 | 57 | ||
| 58 | @pytest.mark.asyncio | 58 | @pytest.mark.asyncio |
| 59 | async def test_prepare_source_url(): | 59 | async def test_prepare_source_url(): |
| 60 | from cogs.music.audio_playback import AudioPlaybackManager | 60 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 61 | 61 | ||
| 62 | source, _, is_url = await AudioPlaybackManager.prepare_source("https://example.com/stream") | 62 | source, _, is_url = await AudioPlaybackManager.prepare_source("https://example.com/stream") |
| 63 | 63 | ||
| @@ -67,7 +67,7 @@ async def test_prepare_source_url(): | |||
| 67 | 67 | ||
| 68 | @pytest.mark.asyncio | 68 | @pytest.mark.asyncio |
| 69 | async def test_prepare_source_local_file(): | 69 | async def test_prepare_source_local_file(): |
| 70 | from cogs.music.audio_playback import AudioPlaybackManager | 70 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 71 | 71 | ||
| 72 | with patch('os.path.exists', return_value=True): | 72 | with patch('os.path.exists', return_value=True): |
| 73 | source, display_name, is_url = await AudioPlaybackManager.prepare_source("/tmp/test.mp3") | 73 | source, display_name, is_url = await AudioPlaybackManager.prepare_source("/tmp/test.mp3") |
| @@ -78,7 +78,7 @@ async def test_prepare_source_local_file(): | |||
| 78 | 78 | ||
| 79 | @pytest.mark.asyncio | 79 | @pytest.mark.asyncio |
| 80 | async def test_cleanup_temp_file(): | 80 | async def test_cleanup_temp_file(): |
| 81 | from cogs.music.audio_playback import AudioPlaybackManager | 81 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 82 | 82 | ||
| 83 | with patch('os.path.exists', return_value=True): | 83 | with patch('os.path.exists', return_value=True): |
| 84 | with patch('os.remove'): | 84 | with patch('os.remove'): |
| @@ -87,7 +87,7 @@ async def test_cleanup_temp_file(): | |||
| 87 | 87 | ||
| 88 | @pytest.mark.asyncio | 88 | @pytest.mark.asyncio |
| 89 | async def test_cleanup_temp_file_not_exists(): | 89 | async def test_cleanup_temp_file_not_exists(): |
| 90 | from cogs.music.audio_playback import AudioPlaybackManager | 90 | from cogs.voice import VoiceManager as AudioPlaybackManager |
| 91 | 91 | ||
| 92 | with patch('os.path.exists', return_value=False): | 92 | with patch('os.path.exists', return_value=False): |
| 93 | await AudioPlaybackManager.cleanup_temp_file("/nonexistent/file.mp3") | 93 | await AudioPlaybackManager.cleanup_temp_file("/nonexistent/file.mp3") |
