feat: filter Wishlist from --my-tasks; document the mode (#71)
Tasks in the "Wishlist" bucket version are now excluded from the list and summary entirely (no due date, noise backlog); exact case match, tasks without a version are unaffected. Document --my-tasks in README and the user guide (sorting, summary metrics, OSC 8 links, stream separation); all examples use synthetic data. Declare ruff known-first-party in pyproject so the lint result is CWD-independent.
This commit is contained in:
@@ -3,6 +3,7 @@ from datetime import date
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
from redmine_reporter.cli import main, parse_date_range
|
||||
from redmine_reporter.client import RedmineAPIError
|
||||
|
||||
@@ -2115,6 +2116,45 @@ class TestMyTasksFlag:
|
||||
assert "потрачено:" in captured.err
|
||||
assert "Открытых:" not in captured.out
|
||||
|
||||
@mock.patch.dict(os.environ, VALID_ENV, clear=True)
|
||||
@mock.patch("redmine_reporter.cli.fetch_open_issues")
|
||||
def test_my_tasks_wishlist_filtered_out_of_table_and_summary(
|
||||
self, mock_fetch, capsys
|
||||
):
|
||||
"""Задача из Wishlist не попадает ни в таблицу, ни в саммари."""
|
||||
wishlist = _make_task_issue(50, subject="Идея на потом")
|
||||
wishlist.fixed_version = mock.MagicMock()
|
||||
wishlist.fixed_version.name = "Wishlist"
|
||||
normal = _make_task_issue(51, subject="Рабочая задача")
|
||||
mock_fetch.return_value = [(wishlist, None), (normal, None)]
|
||||
|
||||
code = main(["--my-tasks"])
|
||||
captured = capsys.readouterr()
|
||||
assert code == 0
|
||||
|
||||
assert _expected_link(51) in captured.out
|
||||
assert "Рабочая задача" in captured.out
|
||||
assert _expected_link(50) not in captured.out
|
||||
assert "Идея на потом" not in captured.out
|
||||
assert "Открытых: 1" in captured.err
|
||||
|
||||
@mock.patch.dict(os.environ, VALID_ENV, clear=True)
|
||||
@mock.patch("redmine_reporter.cli.fetch_open_issues")
|
||||
def test_my_tasks_only_wishlist_reports_empty_and_exits_zero(
|
||||
self, mock_fetch, capsys
|
||||
):
|
||||
"""Все задачи в Wishlist -- выборка пуста: 'Открытых задач нет', код 0."""
|
||||
wishlist = _make_task_issue(60, subject="Ещё идея")
|
||||
wishlist.fixed_version = mock.MagicMock()
|
||||
wishlist.fixed_version.name = "Wishlist"
|
||||
mock_fetch.return_value = [(wishlist, None)]
|
||||
|
||||
code = main(["--my-tasks"])
|
||||
captured = capsys.readouterr()
|
||||
assert code == 0
|
||||
assert "Открытых задач нет" in captured.err
|
||||
assert captured.out == ""
|
||||
|
||||
@mock.patch.dict(os.environ, VALID_ENV, clear=True)
|
||||
@mock.patch("redmine_reporter.cli.fetch_open_issues")
|
||||
def test_my_tasks_api_error_exits_one(self, mock_fetch, capsys):
|
||||
|
||||
Reference in New Issue
Block a user