-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
✨Airbyte CDK: add POST method to HttpMocker #34001
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
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.
I'm wondering how we can make sure the UX is good for body as the requests library allows for multiple ways to create a request and it should be easy for the dev to generate it.
My very generic impression is that if a body is provided for a request (which is going to be the case most often then not because devs think in terms of object more than string and that object matching is less flaky/susceptible to formatting than string), we should match as JSON. However, I think we should play with this a little and see the different cases that need to be supported
…en though it represents json object
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.
Auto-approving so that @askarpets can merge if he think the latest change is good
_A_RESPONSE, | ||
) | ||
|
||
requests.post(_A_URL, params=_SOME_QUERY_PARAMS, headers=_SOME_HEADERS, data=_SOME_REQUEST_BODY_STR) |
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.
Note that I had to change json
to data
here as requests would cast _SOME_REQUEST_BODY_STR
as "some_request_body"
and not some_request_body
actual_request = HttpRequest("mock://test.com/path", headers={"first_header": "value does not match"}) | ||
assert not actual_request.matches(request_to_match) | ||
|
||
def test_given_same_body_mappings_value_when_matches_then_return_true(self): |
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.
I moved the tests you had done in test_http_mocker
to this class to avoid having duplicates and making sure it's as unit as a unit test can be
Co-authored-by: maxi297 <maxime@airbyte.io>
Co-authored-by: maxi297 <maxime@airbyte.io>
What
body
parameter toHttpRequest
objectspost
method toHttpMocker
Recommended reading order
request.py
mocker.py
🚨 User Impact 🚨
No breaking changes
Pre-merge Actions
Updating the Python CDK
Airbyter
Before merging:
--use-local-cdk --name=source-<connector>
as optionsairbyte-ci connectors --use-local-cdk --name=source-<connector> test
After merging: