Skip to content

Commit 153a2a2

Browse files
author
Juliya Smith
authored
echo no results found when searching lg events: (#276)
1 parent 4998d02 commit 153a2a2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/code42cli/cmds/legal_hold.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ def search_events(state, matter_id, event_type, begin, end, format):
165165
events = _get_all_events(state.sdk, matter_id, begin, end)
166166
if event_type:
167167
events = [event for event in events if event["eventType"] == event_type]
168-
formatter.echo_formatted_list(events)
168+
if events:
169+
formatter.echo_formatted_list(events)
170+
else:
171+
click.echo("No results found.")
169172

170173

171174
@legal_hold.group(cls=OrderedGroup)

tests/cmds/test_legal_hold.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,13 @@ def test_search_events_is_called_with_expected_begin_timestamp(runner, cli_state
667667
)
668668

669669

670+
def test_search_events_when_no_results_outputs_no_results(runner, cli_state):
671+
cli_state.sdk.legalhold.get_all_matters.return_value = empty_matters_response
672+
command = ["legal-hold", "search-events"]
673+
result = runner.invoke(cli, command, obj=cli_state)
674+
assert "No results found." in result.output
675+
676+
670677
@pytest.mark.parametrize(
671678
"command, error_msg",
672679
[
@@ -697,7 +704,7 @@ def test_search_events_is_called_with_expected_begin_timestamp(runner, cli_state
697704
),
698705
],
699706
)
700-
def test_alert_rules_command_when_missing_required_parameters_returns_error(
707+
def test_legal_hold_command_when_missing_required_parameters_returns_error(
701708
command, error_msg, runner, cli_state
702709
):
703710
result = runner.invoke(cli, command.split(" "), obj=cli_state)

0 commit comments

Comments
 (0)