From ea66e9fa556a65daffac7105162afc67d9e90862 Mon Sep 17 00:00:00 2001 From: synapz-org Date: Sun, 26 Oct 2025 09:58:48 -0400 Subject: [PATCH] test: add integration test for complete workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/test_integration.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/test_integration.py diff --git a/tests/test_integration.py b/tests/test_integration.py new file mode 100644 index 0000000..b4d2d44 --- /dev/null +++ b/tests/test_integration.py @@ -0,0 +1,32 @@ +import pytest +from click.testing import CliRunner +from src.main import cli + + +@pytest.mark.integration +def test_full_workflow_with_mocks(tmp_path): + """Integration test for complete workflow.""" + runner = CliRunner() + + from unittest.mock import patch + + with patch('src.downloader.yt_dlp.YoutubeDL') as mock_ytdl_class: + # Mock successful download + mock_ytdl = mock_ytdl_class.return_value.__enter__.return_value + mock_ytdl.extract_info.return_value = {'id': '1ZkKzZWnVRRKv'} + + # Run CLI + result = runner.invoke(cli, [ + 'https://x.com/i/spaces/1ZkKzZWnVRRKv', + '--output', str(tmp_path) + ]) + + # Verify success + assert result.exit_code == 0 + assert "Successfully downloaded" in result.output + + # Verify yt-dlp was called correctly + mock_ytdl.extract_info.assert_called_once() + call_args = mock_ytdl_class.call_args + assert 'bestaudio' in call_args[0][0]['format'] + assert 'mp3' in call_args[0][0]['postprocessors'][0]['preferredcodec']