From a769cf0ac5c20a2f4b4cb72bab3ed438480d9a98 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sat, 16 May 2026 18:07:07 +0200 Subject: fix naming not resolving things like %20 Signed-off-by: salmonik --- tests/cogs/test_music_external_play.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/cogs/test_music_external_play.py b/tests/cogs/test_music_external_play.py index 2e9c5b1..8e19423 100644 --- a/tests/cogs/test_music_external_play.py +++ b/tests/cogs/test_music_external_play.py @@ -99,18 +99,11 @@ async def test_upload_to_copyparty_async(play_commands_cog, temp_mp3_file, monke monkeypatch.setenv("COPYPARTY_URL_UPLOAD", "https://catbox.2137697.xyz/sperma/") monkeypatch.setenv("COPYPARTY_PASSWORD", "testpassword") - mock_response = AsyncMock() - mock_response.status = 200 - mock_response.text = AsyncMock(return_value="") - mock_response.json = AsyncMock(return_value={"fileurl": "https://example.com/file.mp3"}) - mock_response.__aenter__ = AsyncMock(return_value=mock_response) - mock_response.__aexit__ = AsyncMock() - - mock_session_context = AsyncMock() - mock_session_context.__aenter__ = AsyncMock(return_value=mock_session_context) - mock_session_context.__aexit__ = AsyncMock() - mock_session_context.post = MagicMock(return_value=mock_response) - - with patch('aiohttp.ClientSession', return_value=mock_session_context): + mock_response = MagicMock() + mock_response.status_code = 200 + mock_response.text = '{"fileurl": "https://example.com/file.mp3"}' + mock_response.json = MagicMock(return_value={"fileurl": "https://example.com/file.mp3"}) + + with patch('cogs.music.play_commands.requests.post', return_value=mock_response) as mock_post: await play_commands_cog._upload_to_copyparty_async(temp_mp3_file) - mock_session_context.post.assert_called_once() + mock_post.assert_called_once() -- cgit v1.2.3