Example #1
0
def test_drive_activity_list_command_human_readable(mocker_http_request,
                                                    gsuite_client):
    """
    Scenario: For google-drive-activity-list command successful run.

    Given:
    - Command args.

    When:
    - Calling google-drive-activity-list command with the parameters provided.

    Then:
    - Ensure command's  human redable should be as expected.
    """
    from GoogleDrive import drive_activity_list_command

    with open('test_data/drive_activity_primary_activities.json',
              encoding='utf-8') as data:
        mock_response = json.load(data)
    with open('test_data/drive_activity_list_hr.txt') as data:
        expected_hr = data.read()

    mocker_http_request.return_value = mock_response

    args = {}
    result = drive_activity_list_command(gsuite_client, args)

    assert result.readable_output == expected_hr
Example #2
0
def test_drive_activity_list_command_success(mocker_http_request,
                                             gsuite_client):
    """
    Scenario: For google-drive-activity-list command successful run.

    Given:
    - Command args.

    When:
    - Calling google-drive-activity-list command with the parameters provided.

    Then:
    - Ensure command's  raw_response, outputs should be as expected.
    """
    from GoogleDrive import drive_activity_list_command

    with open('test_data/drive_activity_response.json',
              encoding='utf-8') as data:
        mock_response = json.load(data)
    with open('test_data/drive_activity_context.json',
              encoding='utf-8') as data:
        expected_res = json.load(data)
    mocker_http_request.return_value = mock_response

    args = {}
    result = drive_activity_list_command(gsuite_client, args)
    assert result.raw_response == mock_response
    assert result.outputs == expected_res
Example #3
0
def test_drive_activity_list_command_no_records(mocker_http_request,
                                                gsuite_client):
    """
    Scenario: For google-drive-activity-list command when no records found.

    Given:
    - Command args.

    When:
    - Calling google-drive-activity-list command with the parameters provided.

    Then:
    - Ensure command's  readable_output.
    """
    from GoogleDrive import drive_activity_list_command

    mocker_http_request.return_value = {"activities": []}

    args = {}
    result = drive_activity_list_command(gsuite_client, args)

    assert result.readable_output == "No Drive Activity found."