from unittest.mock import patch import pytest from app import main @patch("app.update_encoding_queue") def test_missing_store_id_arg_exits_with_error(mock_update_encoding_queue): with patch("sys.argv", ["app.py"]): with pytest.raises(SystemExit): main() assert not mock_update_encoding_queue.called @patch("app.update_encoding_queue") def test_update_encoding_queue_called_with_correct_args(mock_update_encoding_queue): with patch("sys.argv", ["app.py", "1", "--encoder_id", "2", "--error_log", "test error log"]): main() mock_update_encoding_queue.assert_called_once_with(1, 2, "test error log")