Skip to content

Expand local (mocked) API test coverage across all SDK modules #97

Description

@martinkersner

What

Build out a broader local-only test suite that exercises the SDK without hitting the live API. Use responses-mocked HTTP (as in tests/util.py / test_call.py / test_query_params.py) so the suite runs offline with no API key.

Why

Current coverage splits awkwardly:

  • tests/test_integration.py (~1060 lines) is comprehensive but requires DATAMAXI_API_KEY + real network — skipped in normal local/CI runs.
  • The mocked local tests only reach api, error, liquidation, open_interest. Most modules have no local coverage: cex, cex_announcement, cex_candle, cex_fee, cex_symbol, cex_ticker, cex_token, cex_wallet_status, forex, funding_rate, premium, plus naver and telegram.

So a regression in those modules passes CI silently unless someone runs the keyed integration tests.

Scope (this issue: local only)

  • Add mocked unit tests covering each datamaxi/datamaxi/*.py module + naver + telegram: happy-path response shape, query-param construction, and error handling (ClientError/ServerError).
  • Reuse tests/util.mock_http_response; no real network, no API key required.
  • Leave test_integration.py as-is (keyed, network). A later issue can wire it into CI with secrets.

Done when

  • New mocked tests cover every SDK module listed above.
  • python -m pytest tests/ -k "not integration" (or equivalent) passes offline with no DATAMAXI_API_KEY set.
  • pytest --cov=datamaxi shows a meaningful coverage bump over current local-only runs.

Related: #83

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions