Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def _list_requests(
elif last_day:
start_dt = datetime.now() - timedelta(days=1)
end_dt = datetime.now()
elif start_date:
start_dt = datetime.fromisoformat(start_date)
elif start_date or end_date:
start_dt = datetime.fromisoformat(start_date) if start_date else None
end_dt = datetime.fromisoformat(end_date) if end_date else datetime.now()

status_console.print("[blue]Fetching request history...[/blue]")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for requests command."""

from datetime import datetime
from unittest.mock import Mock, patch

import pytest
Expand Down Expand Up @@ -225,6 +226,16 @@ def test_handle_error(
assert result.status == "error"
assert "API connection failed" in result.message

def test_list_requests_end_date_without_start_date(self, command, mock_client):
"""--end-date is forwarded even when --start-date is omitted."""
mock_client.list_requests.return_value = {"requests": []}

command._list_requests(mock_client, None, end_date="2025-11-01")

kwargs = mock_client.list_requests.call_args.kwargs
assert kwargs["start"] is None
assert kwargs["end"] == datetime(2025, 11, 1)


class TestRequestsOutputGating:
"""stdout stays machine-parseable in json/yaml/csv modes.
Expand Down