Skip to content

Feat: Add core integration test mock server support - #165

Merged
kevihan-te merged 2 commits into
mainfrom
CP-2453-python-sdk-add-integration-tests-investigation-po-c
Jul 30, 2026
Merged

Feat: Add core integration test mock server support#165
kevihan-te merged 2 commits into
mainfrom
CP-2453-python-sdk-add-integration-tests-investigation-po-c

Conversation

@kevihan-te

@kevihan-te kevihan-te commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add test-only sdk_test_support mock server helpers under thousandeyes-sdk-core/test/ (not shipped in the published package)
  • Add ApiException.exception_class_for_http_status() and refactor from_response() to use it
  • Add unit tests for mock server behavior (auth, body matching, error paths, path variables) and exception status mapping

JIRA

CP-2453

Test plan

  • PYTHONPATH=src python3 -m pytest thousandeyes-sdk-core/test/test_mock_server.py thousandeyes-sdk-core/test/test_exceptions.py

Dependencies

  • Companion generator PR adds integration test file generation that imports sdk_test_support
  • Generated package integration tests will be synced in a follow-up after both PRs merge

Made with Cursor

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>
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
73850 48837 66% 40% 🟢

New Files

File Coverage Status
thousandeyes-sdk-core/test/conftest.py 80% 🟢
thousandeyes-sdk-core/test/sdk_test_support/init.py 100% 🟢
thousandeyes-sdk-core/test/sdk_test_support/mock_server.py 84% 🟢
thousandeyes-sdk-core/test/sdk_test_support/mock_server_types.py 100% 🟢
thousandeyes-sdk-core/test/test_exceptions.py 100% 🟢
thousandeyes-sdk-core/test/test_mock_server.py 100% 🟢
TOTAL 94% 🟢

Modified Files

File Coverage Status
thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py 52% 🟢
TOTAL 52% 🟢

updated for commit: 0e89a00 by action🐍

@phpinhei-te phpinhei-te left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a public facing repo, please remove internal ticket references from pr title/description.
It's ok on the branch name though

@kevihan-te kevihan-te changed the title CP-2453 Add core integration test mock server support Feat: Add core integration test mock server support Jul 24, 2026
@kevihan-te
kevihan-te requested a review from phpinhei-te July 27, 2026 16:04
Comment on lines +28 to +29
OPERATION_ID_HEADER = "X-TE-Operation-Id"
ERROR_STATUS_HEADER = "X-TE-Error-Status"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are these for exactly ?

@kevihan-te kevihan-te Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kevihan-te
kevihan-te requested a review from phpinhei-te July 28, 2026 10:59
@kevihan-te
kevihan-te merged commit 75929e9 into main Jul 30, 2026
1 check passed
@kevihan-te
kevihan-te deleted the CP-2453-python-sdk-add-integration-tests-investigation-po-c branch July 30, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants