feat(cli): dynamic default range, --version, --verbose, --debug, --url, --api-key, --config
- #17: default date range falls back to current month when .env dates are missing - #18: add --version, --verbose, --debug flags - #20: add --url, --api-key, --config CLI overrides - Config supports CLI overrides for URL/API key and explicit config file loading - Update README with new CLI options - Add tests for new flags and config overrides Closes #17, closes #18, closes #20
This commit is contained in:
@@ -74,9 +74,19 @@ def test_get_default_date_range_from_env():
|
||||
|
||||
@mock.patch.dict(os.environ, {}, clear=True)
|
||||
def test_get_default_date_range_fallback():
|
||||
"""Если даты не заданы -- используется хардкод-заглушка."""
|
||||
"""Если даты не заданы -- используется текущий месяц."""
|
||||
from datetime import date, timedelta
|
||||
|
||||
today = date.today()
|
||||
start = today.replace(day=1)
|
||||
if today.month == 12:
|
||||
next_month = today.replace(year=today.year + 1, month=1, day=1)
|
||||
else:
|
||||
next_month = today.replace(month=today.month + 1, day=1)
|
||||
end = next_month - timedelta(days=1)
|
||||
|
||||
result = Config.get_default_date_range()
|
||||
assert "--" in result # формат YYYY-MM-DD--YYYY-MM-DD
|
||||
assert result == f"{start.isoformat()}--{end.isoformat()}"
|
||||
|
||||
|
||||
@mock.patch.dict(os.environ, {}, clear=True)
|
||||
|
||||
Reference in New Issue
Block a user