-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: simplify RequestOption construction in component factory #303
chore: simplify RequestOption construction in component factory #303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a small nit
@@ -743,7 +745,7 @@ def test_datetime_based_cursor(): | |||
== "since_updated_at" | |||
) | |||
assert stream_slicer.end_time_option.inject_into == RequestOptionType.body_json | |||
assert stream_slicer.end_time_option.field_name.eval({}) == "before_created_at" | |||
assert stream_slicer.end_time_option.field_path[0].eval({}) == "before_created_at" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The outcome could be that stream_slicer.end_time_option.field_path == ["before_created_at", "another dummy parameter that we don't expect"]
. Should we change this to assert
stream_slicer.end_time_option.field_path == ["before_created_at"]`?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, updated the test assertion
24264a0
into
christo/request-option-field-path
What
Refactor components in the model_to_component factory that build child RequestOptions to leverage the re-usable
_create_component_from_model
method, rather than instantiating them with explicit attributes (ie,field_name
). Hopefully this will reduce future tech debt if the RequestOption class is further modified moving forward.Updates a couple tests to verify the behavior when using nested body_json injected values.