diff options
Diffstat (limited to 'tests/cogs/test_music_integration.py')
| -rw-r--r-- | tests/cogs/test_music_integration.py | 26 |
1 files changed, 14 insertions, 12 deletions
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): | |||
| 27 | ctx.author.voice.channel = MagicMock() | 27 | ctx.author.voice.channel = MagicMock() |
| 28 | ctx.guild = MagicMock() | 28 | ctx.guild = MagicMock() |
| 29 | 29 | ||
| 30 | voice_client = AsyncMock() | ||
| 31 | ctx.voice_client = voice_client | ||
| 32 | |||
| 33 | # Test join | 30 | # Test join |
| 34 | ctx.author.voice.channel.connect = AsyncMock(return_value=voice_client) | 31 | mock_vm = MagicMock() |
| 35 | with patch.object(ctx, 'respond', new_callable=AsyncMock): | 32 | mock_vm.connect = AsyncMock() |
| 36 | with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): | 33 | with patch('cogs.music.join.get_voice_manager', return_value=mock_vm): |
| 37 | await join_cog.join.callback(join_cog, ctx) | 34 | with patch.object(ctx, 'respond', new_callable=AsyncMock): |
| 38 | ctx.author.voice.channel.connect.assert_called_once() | 35 | with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): |
| 36 | await join_cog.join.callback(join_cog, ctx) | ||
| 37 | mock_vm.connect.assert_called_once_with(ctx.author.voice.channel) | ||
| 39 | 38 | ||
| 40 | # Test stop | 39 | # Test stop |
| 41 | with patch.object(ctx, 'respond', new_callable=AsyncMock): | 40 | mock_vm_stop = MagicMock() |
| 42 | with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): | 41 | mock_vm_stop.disconnect = AsyncMock() |
| 43 | await stop_cog.stop.callback(stop_cog, ctx) | 42 | with patch('cogs.music.stop.get_voice_manager', return_value=mock_vm_stop): |
| 44 | voice_client.disconnect.assert_called_once() | 43 | with patch.object(ctx, 'respond', new_callable=AsyncMock): |
| 44 | with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock): | ||
| 45 | await stop_cog.stop.callback(stop_cog, ctx) | ||
| 46 | mock_vm_stop.disconnect.assert_called_once_with(ctx.guild) | ||
