예제 #1
0
def test_file_command(mocker, raw_response_general, raw_response_analysis,
                      expected):
    mocker.patch.object(
        client,
        'query',
        side_effect=[raw_response_analysis, raw_response_general])
    results = file_command(
        client, {'file': '6c5360d41bd2b14b1565f5b18e5c203cf512e493'})
    # results is tuple (human_readable, context_entry, raw_response).
    assert expected == results[1]
예제 #2
0
def test_file_command(mocker, raw_response_general, raw_response_analysis, expected):
    """
    Given
    - A file hash.

    When
    - Running file_command with the file.

    Then
    - Validate that the File and DBotScore entry context have the proper values.
    """
    mocker.patch.object(client, 'query', side_effect=[raw_response_analysis, raw_response_general])
    command_results = file_command(client, {'file': '6c5360d41bd2b14b1565f5b18e5c203cf512e493'})
    # results is CommandResults list
    context = command_results[0].to_context()['EntryContext']
    assert expected == context