Skip to content

Commit c0501c1

Browse files
lroolleclaude
andcommitted
fix: stdin rate_limits test needs mock credentials for OAuth gate
On CI there's no ~/.claude/.credentials.json, so _may_have_oauth is false and the quota block is skipped entirely. The test now creates a mock credentials file and sets HOME to the temp directory so the OAuth gate passes and the stdin rate_limits fallback path is reached. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 79dfa6d commit c0501c1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

t/statusline.bats

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,10 @@ JSON
565565

566566
@test "integration: stdin rate_limits fallback without OAuth cache" {
567567
tmpdir=$(mktemp -d)
568+
mkdir -p "$tmpdir/.claude"
569+
echo '{"claudeAiOauth":{"accessToken":"fake"}}' > "$tmpdir/.claude/.credentials.json"
568570
result=$(echo '{"model":{"id":"claude-opus-4-6[1m]","display_name":"Opus"},"cwd":"/tmp/test","workspace":{"current_dir":"/tmp/test"},"cost":{"total_cost_usd":0,"total_lines_added":0,"total_lines_removed":0,"total_api_duration_ms":0},"version":"2.1.141","context_window":{"used_percentage":10,"context_window_size":1000000},"rate_limits":{"five_hour":{"used_percentage":55,"resets_at":1778756400},"seven_day":{"used_percentage":12,"resets_at":1779292800}}}' \
569-
| CLAUDE_CACHE_DIR="$tmpdir" bash "$SCRIPT_DIR/statusline.sh" --test)
571+
| HOME="$tmpdir" CLAUDE_CACHE_DIR="$tmpdir/sessions" bash "$SCRIPT_DIR/statusline.sh" --test)
570572
plain=$(strip_ansi "$result")
571573
[[ "$plain" == *"5h[55%]"* ]]
572574
[[ "$plain" == *"7d[12%]"* ]]

0 commit comments

Comments
 (0)