bito-code-review[bot] commented on PR #42917:
URL: https://github.com/apache/superset/pull/42917#issuecomment-5227046254

   <!-- Bito Reply -->
   The review suggestion is correct. The current test only verifies the HTTP 
status code and message content, which could pass for other types of 400 
errors. To enforce the typed error contract, you should explicitly assert the 
`error_type` and `level` in the response.
   
   To resolve this, update the test assertion in 
`tests/integration_tests/sql_lab/api_tests.py` as follows:
   
   ```python
           assert rv.status_code == 400
           assert resp_data["errors"][0]["error_type"] == 
"GENERIC_COMMAND_ERROR"
           assert resp_data["errors"][0]["level"] == "error"
           assert "tbl" in resp_data["errors"][0]["message"]
           assert "undefined" in resp_data["errors"][0]["message"]
   ```
   
   There are no other comments on this PR to address.
   
   **tests/integration_tests/sql_lab/api_tests.py**
   ```
   assert rv.status_code == 400
           assert resp_data["errors"][0]["error_type"] == 
"GENERIC_COMMAND_ERROR"
           assert resp_data["errors"][0]["level"] == "error"
           assert "tbl" in resp_data["errors"][0]["message"]
           assert "undefined" in resp_data["errors"][0]["message"]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to