From 95e43df1be6a0d7f4f33d729cfa65a6fb8cbc3a5 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 21 May 2026 16:15:21 +0200 Subject: reqs and test fix Signed-off-by: salmonik --- tests/cogs/test_music_integration.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tests/cogs') diff --git a/tests/cogs/test_music_integration.py b/tests/cogs/test_music_integration.py index 1c0260a..692e1c1 100644 --- a/tests/cogs/test_music_integration.py +++ b/tests/cogs/test_music_integration.py @@ -27,18 +27,20 @@ async def test_music_join_stop(music_cog, bot): ctx.author.voice.channel = MagicMock() ctx.guild = MagicMock() - voice_client = AsyncMock() - ctx.voice_client = voice_client - # Test join - ctx.author.voice.channel.connect = AsyncMock(return_value=voice_client) - with patch.object(ctx, 'respond', new_callable=AsyncMock): - with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): - await join_cog.join.callback(join_cog, ctx) - ctx.author.voice.channel.connect.assert_called_once() + mock_vm = MagicMock() + mock_vm.connect = AsyncMock() + with patch('cogs.music.join.get_voice_manager', return_value=mock_vm): + with patch.object(ctx, 'respond', new_callable=AsyncMock): + with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): + await join_cog.join.callback(join_cog, ctx) + mock_vm.connect.assert_called_once_with(ctx.author.voice.channel) # Test stop - with patch.object(ctx, 'respond', new_callable=AsyncMock): - with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): - await stop_cog.stop.callback(stop_cog, ctx) - voice_client.disconnect.assert_called_once() + mock_vm_stop = MagicMock() + mock_vm_stop.disconnect = AsyncMock() + with patch('cogs.music.stop.get_voice_manager', return_value=mock_vm_stop): + with patch.object(ctx, 'respond', new_callable=AsyncMock): + with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): + await stop_cog.stop.callback(stop_cog, ctx) + mock_vm_stop.disconnect.assert_called_once_with(ctx.guild) -- cgit v1.2.3