aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cogs/test_music_join.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/cogs/test_music_join.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/tests/cogs/test_music_join.py b/tests/cogs/test_music_join.py
deleted file mode 100644
index b40d93a..0000000
--- a/tests/cogs/test_music_join.py
+++ /dev/null
@@ -1,56 +0,0 @@
1import pytest
2from unittest.mock import AsyncMock, patch, MagicMock
3from conftest import MockApplicationContext
4
5
6@pytest.fixture
7def join_cog(bot):
8 from cogs.music.join import Join
9 cog = Join(bot)
10 return cog
11
12
13@pytest.fixture
14def stop_cog(bot):
15 from cogs.music.stop import Stop
16 cog = Stop(bot)
17 return cog
18
19
20@pytest.mark.asyncio
21async def test_join_command_success(join_cog, mock_channel, mock_guild, bot, mock_user):
22 ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild)
23 ctx.user = mock_user
24 ctx.author = mock_user
25
26 mock_voice_channel = MagicMock()
27 ctx.author.voice = MagicMock()
28 ctx.author.voice.channel = mock_voice_channel
29
30 with patch('cogs.music.join.get_voice_manager') as mock_get_vm:
31 mock_vm = MagicMock()
32 mock_vm.connect = AsyncMock()
33 mock_get_vm.return_value = mock_vm
34
35 with patch.object(ctx, 'respond', new_callable=AsyncMock):
36 with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock):
37 await join_cog.join.callback(join_cog, ctx)
38 mock_vm.connect.assert_called_once_with(mock_voice_channel)
39
40
41@pytest.mark.asyncio
42async def test_stop_command_success(stop_cog, mock_channel, mock_guild, bot, mock_user):
43 ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild)
44 ctx.user = mock_user
45 ctx.author = mock_user
46
47 with patch('cogs.music.stop.get_voice_manager') as mock_get_vm:
48 mock_vm = MagicMock()
49 mock_vm.disconnect = AsyncMock()
50 mock_get_vm.return_value = mock_vm
51
52 with patch.object(ctx, 'respond', new_callable=AsyncMock):
53 with patch.object(ctx.interaction, 'delete_original_response', new_callable=AsyncMock):
54 await stop_cog.stop.callback(stop_cog, ctx)
55
56 mock_vm.disconnect.assert_called_once_with(mock_guild)