From cd8ed8bc5793985df2c1692072a932ceee517b95 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 8 Jul 2026 02:13:35 +0200 Subject: OPEN THE RUST GATES Signed-off-by: salmonik --- tests/cogs/test_music_play.py | 104 ------------------------------------------ 1 file changed, 104 deletions(-) delete mode 100644 tests/cogs/test_music_play.py (limited to 'tests/cogs/test_music_play.py') diff --git a/tests/cogs/test_music_play.py b/tests/cogs/test_music_play.py deleted file mode 100644 index 7684729..0000000 --- a/tests/cogs/test_music_play.py +++ /dev/null @@ -1,104 +0,0 @@ -import pytest -from unittest.mock import AsyncMock, patch, MagicMock -import os -from conftest import MockApplicationContext - - -@pytest.fixture -def play_commands_cog(bot): - with patch('cogs.utils.temp.get_temp_dir', return_value="/tmp"): - from cogs.music.play_commands import PlayCommands - cog = PlayCommands(bot) - return cog - - -@pytest.fixture -def loop_cog(bot): - from cogs.music.loop import Loop - cog = Loop(bot) - return cog - - -@pytest.mark.asyncio -async def test_create_search_embed_empty(play_commands_cog): - embed, view = await play_commands_cog._create_search_embed([]) - - assert embed.title == "Wyniki wyszukiwania" - assert len(view.children) == 0 - - -@pytest.mark.asyncio -async def test_create_search_embed_with_candidates(play_commands_cog): - candidates = [ - "https://example.com/test1.mp3", - "https://example.com/test2.mp3" - ] - - embed, view = await play_commands_cog._create_search_embed(candidates) - - assert embed.title == "Wyniki wyszukiwania" - assert len(embed.fields) == 2 - - -@pytest.mark.asyncio -async def test_play_command_no_file_or_search(play_commands_cog, mock_channel, mock_guild, bot): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - await play_commands_cog.play.callback(play_commands_cog, ctx, melodia=None, file=None, compressed=False) - mock_respond.assert_called_once() - args = mock_respond.call_args - assert "Musisz podać" in str(args) - - -@pytest.mark.asyncio -async def test_play_command_both_file_and_search(play_commands_cog, mock_channel, mock_guild, bot): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - - mock_file = MagicMock() - mock_file.filename = "test.mp3" - - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - await play_commands_cog.play.callback(play_commands_cog, ctx, melodia="test", file=mock_file, compressed=False) - mock_respond.assert_called_once() - args = mock_respond.call_args - assert "nie oba" in str(args) or "LUB" in str(args) - - -def test_loop_cog_is_looping_initial(loop_cog): - assert loop_cog.is_looping(123) == False - - -def test_loop_cog_set_looping(loop_cog): - loop_cog.set_looping(123, True) - assert loop_cog.is_looping(123) == True - - -@pytest.mark.asyncio -async def test_loop_command_toggle_on(loop_cog, mock_channel, mock_guild, bot, mock_user): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - ctx.user = mock_user - ctx.author = mock_user - ctx.guild.id = 123 - - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - await loop_cog.loop.callback(loop_cog, ctx) - mock_respond.assert_called_once() - args = mock_respond.call_args - assert "włączony" in str(args) - - -@pytest.mark.asyncio -async def test_loop_command_toggle_off(loop_cog, mock_channel, mock_guild, bot, mock_user): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - ctx.user = mock_user - ctx.author = mock_user - ctx.guild.id = 456 - - loop_cog.set_looping(456, True) - - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - await loop_cog.loop.callback(loop_cog, ctx) - mock_respond.assert_called_once() - args = mock_respond.call_args - assert "wyłączony" in str(args) -- cgit v1.2.3