diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/cogs/test_downloader.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/cogs/test_downloader.py b/tests/cogs/test_downloader.py index 91eef93..6ac8ae7 100644 --- a/tests/cogs/test_downloader.py +++ b/tests/cogs/test_downloader.py | |||
| @@ -14,9 +14,9 @@ def downloader_cog(bot): | |||
| 14 | @pytest.mark.asyncio | 14 | @pytest.mark.asyncio |
| 15 | async def test_download_command_success_file(downloader_cog, mock_channel, mock_guild, bot): | 15 | async def test_download_command_success_file(downloader_cog, mock_channel, mock_guild, bot): |
| 16 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 16 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 17 | 17 | ||
| 18 | mock_file_path = "/tmp/test_video.mp4" | 18 | mock_file_path = "/tmp/test_video.mp4" |
| 19 | 19 | ||
| 20 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ | 20 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ |
| 21 | "status": "success", | 21 | "status": "success", |
| 22 | "type": "file", | 22 | "type": "file", |
| @@ -34,7 +34,7 @@ async def test_download_command_success_file(downloader_cog, mock_channel, mock_ | |||
| 34 | @pytest.mark.asyncio | 34 | @pytest.mark.asyncio |
| 35 | async def test_download_command_success_url(downloader_cog, mock_channel, mock_guild, bot): | 35 | async def test_download_command_success_url(downloader_cog, mock_channel, mock_guild, bot): |
| 36 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 36 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 37 | 37 | ||
| 38 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ | 38 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ |
| 39 | "status": "success", | 39 | "status": "success", |
| 40 | "type": "url", | 40 | "type": "url", |
| @@ -50,7 +50,7 @@ async def test_download_command_success_url(downloader_cog, mock_channel, mock_g | |||
| 50 | @pytest.mark.asyncio | 50 | @pytest.mark.asyncio |
| 51 | async def test_download_command_error(downloader_cog, mock_channel, mock_guild, bot): | 51 | async def test_download_command_error(downloader_cog, mock_channel, mock_guild, bot): |
| 52 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 52 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 53 | 53 | ||
| 54 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ | 54 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ |
| 55 | "status": "error", | 55 | "status": "error", |
| 56 | "type": "error", | 56 | "type": "error", |
| @@ -65,10 +65,10 @@ async def test_download_command_error(downloader_cog, mock_channel, mock_guild, | |||
| 65 | @pytest.mark.asyncio | 65 | @pytest.mark.asyncio |
| 66 | async def test_message_download_with_url(downloader_cog, mock_channel, mock_guild, bot, mock_user): | 66 | async def test_message_download_with_url(downloader_cog, mock_channel, mock_guild, bot, mock_user): |
| 67 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 67 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 68 | 68 | ||
| 69 | mock_message = MagicMock() | 69 | mock_message = MagicMock() |
| 70 | mock_message.content = "Check this out https://example.com/video" | 70 | mock_message.content = "Check this out https://example.com/video" |
| 71 | 71 | ||
| 72 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ | 72 | with patch('cogs.downloader.Downloader.download_standalone', return_value={ |
| 73 | "status": "success", | 73 | "status": "success", |
| 74 | "type": "file", | 74 | "type": "file", |
| @@ -82,12 +82,12 @@ async def test_message_download_with_url(downloader_cog, mock_channel, mock_guil | |||
| 82 | @pytest.mark.asyncio | 82 | @pytest.mark.asyncio |
| 83 | async def test_message_download_no_url(downloader_cog, mock_channel, mock_guild, bot): | 83 | async def test_message_download_no_url(downloader_cog, mock_channel, mock_guild, bot): |
| 84 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 84 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 85 | 85 | ||
| 86 | mock_message = MagicMock() | 86 | mock_message = MagicMock() |
| 87 | mock_message.content = "No URL here" | 87 | mock_message.content = "No URL here" |
| 88 | 88 | ||
| 89 | with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: | 89 | with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: |
| 90 | await downloader_cog.message_download.callback(downloader_cog, ctx, message=mock_message) | 90 | await downloader_cog.message_download.callback(downloader_cog, ctx, message=mock_message) |
| 91 | mock_respond.assert_called_once() | 91 | mock_respond.assert_called_once() |
| 92 | call_args = mock_respond.call_args | 92 | call_args = mock_respond.call_args |
| 93 | assert "Brak" in str(call_args) \ No newline at end of file | 93 | assert "Brak" in str(call_args) |
