refactor: refatoring updating image_request.py and updating tests #108
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.
Issue #, if available: n/a
Notes
This PR introduces several improvements to the
ImageRequest
class, focusing on enhanced initialization, validation, and backward compatibility, along with updated unit tests to ensure robust functionality.Key Changes:
Initialization Improvements:
post_processing
) are only applied when attributes are not explicitly set.outputBucket
andoutputPrefix
to ensure backward compatibility foroutputs
initialization.Refactoring and Cleaner Structure:
_parse_outputs
,_parse_post_processing
) to improve readability and maintainability.from_external_message
method to correctly handle both modern and legacy input formats, ensuring reliable parsing of attributes.Enhanced Validation Logic:
is_valid()
method to check for validSinkType
values inoutputs
, ensuring that only recognized sink types (e.g.,S3
,KINESIS
) are allowed. This prevents configuration errors.Updated and Expanded Unit Tests:
outputBucket
andoutputPrefix
are used instead of modernoutputs
fields.None
values and verifying correct application of defaults.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.