Skip to content

Commit 6661d18

Browse files
author
Esteban Echeverry
committed
Merge branch 'feat/05_reports' into feat/06_main
2 parents 0db4169 + ce70194 commit 6661d18

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

taskit/infrastructure/cli/report.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ def report(obj):
99

1010

1111
@report.command()
12+
@click.option('--project_id', default="")
1213
@click.pass_obj
13-
def tasks(obj):
14-
result = obj.state_reporter.list_tasks()
14+
def tasks(obj, project_id):
15+
if project_id:
16+
result = obj.state_reporter.list_tasks_in_project(project_id)
17+
else:
18+
result = obj.state_reporter.list_tasks()
1519
click.echo(tabulate(result, headers='keys'))
1620

1721

tests/infrastructure/cli/test_report.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def test_cli_report_tasks(mock_state: Mock):
1111
assert result.exit_code == 0
1212

1313

14+
def test_cli_report_tasks_in_project(mock_state: Mock):
15+
runner = CliRunner()
16+
result = runner.invoke(
17+
cli, ['report', 'tasks', '--project_id=P-1'], obj=mock_state)
18+
mock_state.state_reporter.list_tasks_in_project.assert_called_with(ANY)
19+
assert result.exit_code != 0
20+
21+
1422
def test_cli_report_projects(mock_state: Mock):
1523
runner = CliRunner()
1624
result = runner.invoke(

0 commit comments

Comments
 (0)