Test that the FetchResults, GetResultSetMetadata and CloseOperation APIs validate the session secret.
(self)
| 267 | |
| 268 | @needs_session() |
| 269 | def test_invalid_secret(self): |
| 270 | """Test that the FetchResults, GetResultSetMetadata and CloseOperation APIs validate |
| 271 | the session secret.""" |
| 272 | execute_req = TCLIService.TExecuteStatementReq( |
| 273 | self.session_handle, "select 'something something'") |
| 274 | execute_resp = self.hs2_client.ExecuteStatement(execute_req) |
| 275 | HS2TestSuite.check_response(execute_resp) |
| 276 | |
| 277 | good_handle = execute_resp.operationHandle |
| 278 | bad_handle = create_op_handle_without_secret(good_handle) |
| 279 | |
| 280 | # Fetching and closing operations with an invalid handle should be a no-op, i.e. |
| 281 | # the later operations with the good handle should succeed. |
| 282 | HS2TestSuite.check_invalid_query(self.hs2_client.FetchResults( |
| 283 | TCLIService.TFetchResultsReq(operationHandle=bad_handle, maxRows=1024)), |
| 284 | expect_legacy_err=True) |
| 285 | HS2TestSuite.check_invalid_query(self.hs2_client.GetResultSetMetadata( |
| 286 | TCLIService.TGetResultSetMetadataReq(operationHandle=bad_handle)), |
| 287 | expect_legacy_err=True) |
| 288 | HS2TestSuite.check_invalid_query(self.hs2_client.CloseOperation( |
| 289 | TCLIService.TCloseOperationReq(operationHandle=bad_handle)), |
| 290 | expect_legacy_err=True) |
| 291 | |
| 292 | # Ensure that the good handle remained valid. |
| 293 | HS2TestSuite.check_response(self.hs2_client.FetchResults( |
| 294 | TCLIService.TFetchResultsReq(operationHandle=good_handle, maxRows=1024))) |
| 295 | HS2TestSuite.check_response(self.hs2_client.GetResultSetMetadata( |
| 296 | TCLIService.TGetResultSetMetadataReq(operationHandle=good_handle))) |
| 297 | HS2TestSuite.check_response(self.hs2_client.CloseOperation( |
| 298 | TCLIService.TCloseOperationReq(operationHandle=good_handle))) |
nothing calls this directly
no test coverage detected