Feat: Add core integration test mock server support - #165
Conversation
Move the integration mock server into test-only sdk_test_support helpers and expose ApiException.exception_class_for_http_status for generated integration error assertions. Co-authored-by: Cursor <cursoragent@cursor.com>
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
phpinhei-te
left a comment
There was a problem hiding this comment.
This is a public facing repo, please remove internal ticket references from pr title/description.
It's ok on the branch name though
| OPERATION_ID_HEADER = "X-TE-Operation-Id" | ||
| ERROR_STATUS_HEADER = "X-TE-Error-Status" |
There was a problem hiding this comment.
what are these for exactly ?
There was a problem hiding this comment.
They are used in the mock server.
When the mock server receive the request, it will use these X-TE-Operation-Id to identify which operation the request want to perform so the server can check the request path/param/body against the corresponding spec.
X-TE-Error-Status is used for the error response path validation. When the request contains this header, the mock server will return the corresponding example error response.
There was a problem hiding this comment.
should we use wiremock instead like we are doing in java? happy to go with this approach tho just want to make sure implementations are aligned.
Summary
sdk_test_supportmock server helpers underthousandeyes-sdk-core/test/(not shipped in the published package)ApiException.exception_class_for_http_status()and refactorfrom_response()to use itJIRA
CP-2453
Test plan
PYTHONPATH=src python3 -m pytest thousandeyes-sdk-core/test/test_mock_server.py thousandeyes-sdk-core/test/test_exceptions.pyDependencies
sdk_test_supportMade with Cursor