chore: Add integration and unit tests for Python and .NET SDKs#132
Draft
joakimia wants to merge 4 commits into
Draft
chore: Add integration and unit tests for Python and .NET SDKs#132joakimia wants to merge 4 commits into
joakimia wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands the Python SDK with missing endpoint wrappers, introduces a full integration- and unit-test suite covering all Python endpoints, and adds test fake infrastructure for the .NET
WhenHandlingTransientErrorstest suite.Python SDK
New endpoint wrappers
The following endpoints existed in the generated API client but were not exposed through the SDK wrapper or
HeimdallApiClient. They are now fully implemented:grid_insights.py/client.pyget_currentsget_conductor_temperaturesget_icingget_sag_and_clearanceget_apparent_powerget_latest_apparent_powerget_icing_forecastcapacity_monitoring.py/client.pyget_heimdall_dlrsget_heimdall_aarsget_circuit_ratingsTests
Tests are split by stability:
Heimdall Power Line(d67d2205-…) test fixture.latestandforecastendpoints using mocks, since these can return404when no recent data exists. Each endpoint is tested for:200 OK→ parsed response is returned404 Not Found→HeimdallApiError(status_code=404)is raised404is not retried →time.sleepis never calledNew test files:
tests/integration/test_when_fetching_capacity_monitoring.pyget_heimdall_dlrs,get_heimdall_aars,get_circuit_ratings+ invalid-ID error pathstests/integration/test_when_fetching_grid_insights.pyget_currents,get_conductor_temperatures,get_icing,get_sag_and_clearance,get_apparent_power+ invalid-ID error pathtests/unit/test_latest_endpoints.pylatest/forecastmethods onHeimdallApiClient— 200 OK, 404 raised, 404 not retriedtests/unit/test_auth_service.py.NET SDK
Test fakes for
WhenHandlingTransientErrorsAdded fake infrastructure under
WhenHandlingTransientErrors/Fakes/to support unit testing of theHeimdallApiHttpClientwhen transient errors occur:FakeHttpMessageHandler.csWhenHandlingErrorResponsesHeimdallApiHttpClientFactory.csHeimdallApiHttpClientwith the fake handler and a no-op delay for instant testsStubAccessTokenProvider.csIAccessTokenProviderreturning a static tokenThese follow the same pattern as the existing
WhenHandlingErrorResponses/Fakes/test infrastructure.