This PR replaces the real find_features method of the SMDetector class with a mocked version of (invoke_endpoint) called by the SageMaker client during testing, simulating a GeoJSON response from a SageMaker model without real endpoint invocations. Removing any logic for supporting NOOP models in the find features methods in the associated Detection classes.
Key Changes:
Mocking find_features:
Added mock_find_features to simulate model inference, returning a GeoJSON FeatureCollection.
Patched find_features in SMDetector using unittest.mock.patch.object to use the mock in tests.
Updated Unit Test (test_process_bounds_image_request):
Integrated mock_find_features into the SMDetector instance for controlled testing.
Retained Stubber to simulate the SageMaker client response for invoke_endpoint.
Benefits:
Improved test coverage and reliability for feature detection logic.
Testing:
All unit tests, including the modified test, passed.
Manual validation confirmed correct integration and output format.
Checklist
Before you submit a pull request, please make sure you have the following:
[x] Code changes are compact and well-structured to facilitate easy review
[x] Changes are documented in the README.md and other relevant documentation pages
[x] PR title and description accurately reflect the changes and are detailed enough for historical tracking
[x] PR contains tests that cover all new code and the code has been manual tested
[x] All new dependencies are declared (if any), and no unnecessary libraries are added
[x] Performance impacts (if any) of the changes are evaluated and documented
[x] Security implications of the changes (if any) are reviewed and addressed
Issue #, if available: n/a
Notes
This PR replaces the real
find_features
method of theSMDetector
class with a mocked version of (invoke_endpoint
) called by the SageMaker client during testing, simulating a GeoJSON response from a SageMaker model without real endpoint invocations. Removing any logic for supporting NOOP models in the find features methods in the associated Detection classes.Key Changes:
Mocking
find_features
:mock_find_features
to simulate model inference, returning a GeoJSONFeatureCollection
.find_features
inSMDetector
usingunittest.mock.patch.object
to use the mock in tests.Updated Unit Test (
test_process_bounds_image_request
):mock_find_features
into theSMDetector
instance for controlled testing.Stubber
to simulate the SageMaker client response forinvoke_endpoint
.Benefits:
Testing:
Checklist
Before you submit a pull request, please make sure you have the following:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.