예제 #1
0
def test_feed_tags_param(mocker):
    """Unit test
    Given
    - fetch indicators command
    - command args
    - command raw response
    When
    - mock the feed tags param.
    - mock the Client's daily_http_request.
    Then
    - run the fetch incidents command using the Client
    Validate The value of the tags field.
    """
    client = Client(api_key="a", insecure=False)
    mocker.patch.object(client, 'daily_http_request', return_value=INDICATORS)
    indicators = fetch_indicators_command(client, ['test_tag'])
    assert indicators[0].get('fields').get('tags') == ['test_tag']
예제 #2
0
def test_type_finder():
    client = Client(api_key="a", insecure=False)
    for i in range(0, 9):
        indicator_type = client.find_indicator_type(INDICATORS[i])
        assert indicator_type == TYPES[i]
예제 #3
0
def test_fetch_indicators_command(mocker):
    client = Client(api_key="a", insecure=False)
    mocker.patch.object(client, 'daily_http_request', return_value=INDICATORS)
    indicators = fetch_indicators_command(client, 9, 0)
    for i in range(0, 9):
        assert indicators[i]['type'] == TYPES[i]
예제 #4
0
def auto_focus_client():
    return Client(api_key="a", insecure=False)