@@ -69,11 +69,12 @@ def test_execute_transaction(self, mock_redshift_conn, test_instance,
6969 mock_cursor = mocker .MagicMock ()
7070 test_instance .conn .cursor .return_value = mock_cursor
7171
72- test_instance .execute_transaction (['query 1' , 'query 2' ])
72+ test_instance .execute_transaction ([('query 1' , None ),
73+ ('query 2 %s %s' , ('a' , 1 ))])
7374 mock_cursor .execute .assert_has_calls ([
7475 mocker .call ('BEGIN TRANSACTION;' ),
75- mocker .call ('query 1' ),
76- mocker .call ('query 2' ),
76+ mocker .call ('query 1' , None ),
77+ mocker .call ('query 2 %s %s' , ( 'a' , 1 ) ),
7778 mocker .call ('END TRANSACTION;' )])
7879 test_instance .conn .commit .assert_called_once ()
7980 mock_cursor .close .assert_called_once ()
@@ -87,12 +88,13 @@ def test_execute_transaction_with_exception(
8788 test_instance .conn .cursor .return_value = mock_cursor
8889
8990 with pytest .raises (RedshiftClientError ):
90- test_instance .execute_transaction (['query 1' , 'query 2' ])
91+ test_instance .execute_transaction (
92+ [('query 1' , None ), ('query 2' , None )])
9193
9294 mock_cursor .execute .assert_has_calls ([
9395 mocker .call ('BEGIN TRANSACTION;' ),
94- mocker .call ('query 1' ),
95- mocker .call ('query 2' )])
96+ mocker .call ('query 1' , None ),
97+ mocker .call ('query 2' , None )])
9698 test_instance .conn .commit .assert_not_called ()
9799 test_instance .conn .rollback .assert_called_once ()
98100 mock_cursor .close .assert_called_once ()
0 commit comments