Repository navigation
Conversation
Existing tests only verified response types. This adds:
- Request method, URL, and body/query-param assertions for
historical_data, trigger_range, convert_position, place_mf_order,
cancel_mf_order, place_mf_sip, modify_mf_sip, and cancel_mf_sip
- Parameterized tests for quote(), ohlc(), and ltp() covering both
positional-arg and legacy list-style calling conventions
Closes zerodha#257
Author
|
Hi @rainandsalt — I've added request-side assertions and parametrized tests for the methods in #257. Would love your feedback when you get a chance. |
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
Fixes #257.
Several REST API unit tests in
tests/unit/test_connect.pyonly verified response types (e.g.assert type(result) == list). They did not verify that the correct HTTP method, URL, or request body/query parameters were actually being sent. A breaking change to how a method constructs its request could go undetected.Changes
1. Request assertion tests
Added tests that verify the outgoing request for:
historical_datainstrument_tokenandinterval; query params includefrom,to,continuous,oihistorical_data(flags)continuous=Trueserializes as1,oi=Trueserializes as1trigger_rangetransaction_typelowercased in URL, instruments in query paramsconvert_positionplace_mf_ordertradingsymbol,transaction_type,amount,tagin bodycancel_mf_orderorder_idin URLplace_mf_siptradingsymbol,amount,instalments,frequency,instalment_dayin bodymodify_mf_sipsip_idin URL,amount,status,instalmentsin bodycancel_mf_sipsip_idin URL2. Parameterized tests for quote, ohlc, ltp
Added
@pytest.mark.parametrizetests covering both supported calling styles:Same parametrize coverage applied to
ohlc()andltp().Test results
52 passed (31 existing + 21 new). No changes to library code.