aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cogs/test_music_audio.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-21 17:10:23 +0200
committersalmonik <raisersoft@proton.me>2026-05-21 17:10:23 +0200
commit2e614665e0c62fe572b5af53a2a6be1116d66720 (patch)
treedbb48ad5d665a3f3d8c793db30a523264f17bcde /tests/cogs/test_music_audio.py
parentfix naming not resolving things like %20 (diff)
parentFix voice reconnect race: reuse VoiceClient instead of destroying it (diff)
downloadsenator-sperma-2e614665e0c62fe572b5af53a2a6be1116d66720.tar.gz
senator-sperma-2e614665e0c62fe572b5af53a2a6be1116d66720.zip
Merge pull request 'Voice related fixes, alongside simplifying assistant' (#5) from dev into main
Reviewed-on: https://codeberg.org/salmonik/senator-sperma/pulls/5
Diffstat (limited to '')
-rw-r--r--tests/cogs/test_music_audio.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/cogs/test_music_audio.py b/tests/cogs/test_music_audio.py
index 705f1b3..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
8async def test_validate_voice_channel_not_in_voice(): 8async 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
22async def test_validate_voice_channel_in_voice(): 22async 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
37async def test_prepare_file_source_file_not_found(): 37async 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
47async def test_prepare_file_source_absolute_path(): 47async 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,9 +57,9 @@ async def test_prepare_file_source_absolute_path():
57 57
58@pytest.mark.asyncio 58@pytest.mark.asyncio
59async def test_prepare_source_url(): 59async 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(MagicMock(), "https://example.com/stream") 62 source, _, is_url = await AudioPlaybackManager.prepare_source("https://example.com/stream")
63 63
64 assert is_url == True 64 assert is_url == True
65 assert source == "https://example.com/stream" 65 assert source == "https://example.com/stream"
@@ -67,10 +67,10 @@ async def test_prepare_source_url():
67 67
68@pytest.mark.asyncio 68@pytest.mark.asyncio
69async def test_prepare_source_local_file(): 69async 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(MagicMock(), "/tmp/test.mp3") 73 source, display_name, is_url = await AudioPlaybackManager.prepare_source("/tmp/test.mp3")
74 74
75 assert is_url == False 75 assert is_url == False
76 assert display_name == "test" 76 assert display_name == "test"
@@ -78,7 +78,7 @@ async def test_prepare_source_local_file():
78 78
79@pytest.mark.asyncio 79@pytest.mark.asyncio
80async def test_cleanup_temp_file(): 80async 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
89async def test_cleanup_temp_file_not_exists(): 89async 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")