test: expand local (mocked) API test coverage across all SDK modules#101
Merged
Merged
Conversation
Cover cex aggregator wiring + candle/ticker/fee/wallet_status/ announcement/token/symbol: happy-path shape, wire query params, ClientError/ServerError. Offline, no API key (responses-mocked).
Cover forex/premium/funding_rate/naver/telegram plus return-shape and error coverage for liquidation/open_interest: happy-path shape, wire query params, ClientError/ServerError. Offline, no API key. Local coverage 34% -> 76%.
Add a keyless pytest step after flake8 running `pytest tests/ -k "not integration"`. Excludes the live test_integration.py; keyed test_call.py tests skip with no key.
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.
Closes #97
Summary
Adds a broad local-only (responses-mocked) test suite so every SDK module is exercised offline with no
DATAMAXI_API_KEYand no real network, and wires that suite into CI. Previously onlyapi,error,liquidation,open_interesthad any mocked coverage; a regression in the other modules passed CI silently. Each new test file covers happy-path response shape (DataFrame vs dict/list + a key field), wire query-param construction (incl. snake_case/camelCase translation), and error handling (ClientErroron 4xx,ServerErroron 5xx).test_integration.pyis left untouched.Modules now covered (new mocked tests)
cex)cex_candle,cex_ticker,cex_fee,cex_wallet_status,cex_announcement,cex_token,cex_symbolforex,premium,funding_ratenaver,telegramliquidation/open_interest— added return-shape + error coverage (param translation already intest_query_params.py)CI
Adds a keyless "Run offline mocked tests" step (after flake8) to
.github/workflows/python-package.yml:python -m pytest tests/ -k "not integration" -q. The-k "not integration"filter excludes the livetest_integration.py; the keyedtest_call.pytests skip cleanly without a key, so CI stays green with no secrets. Coverage stays a local-only concern (no--covin CI).Test plan
Result: 108 passed, 11 skipped (skipped = keyed
test_call.py), integration deselected. Fully offline, no API key.Coverage (
--cov=datamaxi): 34% → 76% local-only.Lint:
black+flake8clean on all new files.