@@ -188,13 +188,16 @@ def test_arraysize_buffer_size_passthrough(
188
188
def test_closing_result_set_with_closed_connection_soft_closes_commands (self ):
189
189
mock_connection = Mock ()
190
190
mock_backend = Mock ()
191
+ mock_results = Mock ()
191
192
mock_backend .fetch_results .return_value = (Mock (), False )
192
193
193
194
result_set = ThriftResultSet (
194
195
connection = mock_connection ,
195
196
execute_response = Mock (),
196
197
thrift_client = mock_backend ,
197
198
)
199
+ result_set .results = mock_results
200
+
198
201
# Setup session mock on the mock_connection
199
202
mock_session = Mock ()
200
203
mock_session .open = False
@@ -204,12 +207,14 @@ def test_closing_result_set_with_closed_connection_soft_closes_commands(self):
204
207
205
208
self .assertFalse (mock_backend .close_command .called )
206
209
self .assertTrue (result_set .has_been_closed_server_side )
210
+ mock_results .close .assert_called_once ()
207
211
208
212
def test_closing_result_set_hard_closes_commands (self ):
209
213
mock_results_response = Mock ()
210
214
mock_results_response .has_been_closed_server_side = False
211
215
mock_connection = Mock ()
212
216
mock_thrift_backend = Mock ()
217
+ mock_results = Mock ()
213
218
# Setup session mock on the mock_connection
214
219
mock_session = Mock ()
215
220
mock_session .open = True
@@ -219,12 +224,14 @@ def test_closing_result_set_hard_closes_commands(self):
219
224
result_set = ThriftResultSet (
220
225
mock_connection , mock_results_response , mock_thrift_backend
221
226
)
227
+ result_set .results = mock_results
222
228
223
229
result_set .close ()
224
230
225
231
mock_thrift_backend .close_command .assert_called_once_with (
226
232
mock_results_response .command_id
227
233
)
234
+ mock_results .close .assert_called_once ()
228
235
229
236
def test_executing_multiple_commands_uses_the_most_recent_command (self ):
230
237
mock_result_sets = [Mock (), Mock ()]
0 commit comments