|
63 | 63 | TEST_PRESERVATION_POLICY_UID |
64 | 64 | ) |
65 | 65 |
|
| 66 | +TEST_LEGAL_HOLD_LIST = [ |
| 67 | + { |
| 68 | + "legalHolds": [ |
| 69 | + { |
| 70 | + "legalHoldUid": "932880202064992021", |
| 71 | + "name": "test", |
| 72 | + "description": "", |
| 73 | + "active": True, |
| 74 | + "creationDate": "2019-12-19T20:32:10.763Z", |
| 75 | + "lastModified": "2019-12-19T20:32:10.781Z", |
| 76 | + "creator": { |
| 77 | + "userUid": "921286907298179098", |
| 78 | + |
| 79 | + |
| 80 | + }, |
| 81 | + "holdPolicyUid": "901109555892625150", |
| 82 | + "creator_username": "[email protected]", |
| 83 | + }, |
| 84 | + ], |
| 85 | + } |
| 86 | +] |
| 87 | + |
| 88 | +TEST_LEGAL_HOLD_EMPTY_LIST = [{"legalHolds": []}] |
| 89 | + |
66 | 90 |
|
67 | 91 | @pytest.fixture |
68 | 92 | def preservation_policy_response(mocker): |
@@ -371,3 +395,36 @@ def test_remove_bulk_users_uses_expected_arguments(runner, mocker, cli_state): |
371 | 395 | assert bulk_processor.call_args[0][1] == [ |
372 | 396 | {"matter_id": "test", "username": "value"} |
373 | 397 | ] |
| 398 | + |
| 399 | + |
| 400 | +def test_list_with_format_option_returns_expected_format(runner, cli_state): |
| 401 | + cli_state.sdk.legalhold.get_all_matters.return_value = TEST_LEGAL_HOLD_LIST |
| 402 | + |
| 403 | + result = runner.invoke(cli, ["legal-hold", "list", "-f", "csv"], obj=cli_state) |
| 404 | + assert "Matter ID,Name,Description,Creator,Creation Date" in result.output |
| 405 | + assert "932880202064992021" in result.output |
| 406 | + |
| 407 | + |
| 408 | +def test_list_with_format_option_returns_no_response_when_response_is_empty( |
| 409 | + runner, cli_state |
| 410 | +): |
| 411 | + cli_state.sdk.legalhold.get_all_matters.return_value = TEST_LEGAL_HOLD_EMPTY_LIST |
| 412 | + result = runner.invoke(cli, ["legal-hold", "list", "-f", "csv"], obj=cli_state) |
| 413 | + assert "Matter ID,Name,Description,Creator,Creation Date" not in result.output |
| 414 | + |
| 415 | + |
| 416 | +def test_show_with_format_option_returns_expected_format( |
| 417 | + runner, cli_state, check_matter_accessible_success, get_user_id_success |
| 418 | +): |
| 419 | + cli_state.sdk.legalhold.get_all_matter_custodians.return_value = ( |
| 420 | + ACTIVE_AND_INACTIVE_LEGAL_HOLD_MEMBERSHIPS_RESULT |
| 421 | + ) |
| 422 | + result = runner.invoke( |
| 423 | + cli, ["legal-hold", "show", TEST_MATTER_ID, "-f", "csv"], obj=cli_state |
| 424 | + ) |
| 425 | + |
| 426 | + assert "Matter ID,Name,Description,Creator,Creation Date" in result.output |
| 427 | + assert ( |
| 428 | + "88888,Test_Matter,,[email protected],2020-01-01T00:00:00.000-06:00" |
| 429 | + in result.output |
| 430 | + ) |
0 commit comments