Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/integration/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def test_bad_auth_returns_auth_error(self) -> None:

Uses a throwaway client with a valid RSA key but wrong key_id,
so signing succeeds but the server rejects the credentials.

Targets ``portfolio.balance()`` because it is account-scoped and
always auth-required. ``markets.list()`` was previously used but
Kalshi began serving public market data unauthenticated, so it
no longer exercises the auth path.
"""
dummy_key = rsa.generate_private_key(
public_exponent=65537, key_size=2048
Expand All @@ -68,7 +73,7 @@ def test_bad_auth_returns_auth_error(self) -> None:

try:
with pytest.raises(KalshiAuthError) as exc_info:
client.markets.list(limit=1)
client.portfolio.balance()

exc = exc_info.value
assert exc.status_code in (401, 403)
Expand Down
Loading