Пример #1
0
def test_feed_tags(mocker):
    """
    Given:
    - feedTags parameter
    When:
    - Executing fetch command on feed
    Then:
    - Validate the tags supplied are added to the tags list in addition to the tags that were there before
    """
    global bundle_index
    global submitted_indicators

    mocker.patch.object(demisto, 'params', return_value=init_params())
    mocker.patch('requests.sessions.Session.send', new=mocked_request)

    from Sixgill_Darkfeed import fetch_indicators_command
    from sixgill.sixgill_feed_client import SixgillFeedClient
    from sixgill.sixgill_constants import FeedStream

    client = SixgillFeedClient("client_id", "client_secret", "some_channel",
                               FeedStream.DARKFEED, demisto, 1000)

    output = fetch_indicators_command(client, tags=['tag1', 'tag2'])
    assert all(item in output[0]['fields']['tags']
               for item in ['tag1', 'tag2'])
    assert any(item in output[0]['fields']['tags']
               for item in ['compromised', 'ip', 'url'])
Пример #2
0
def test_fetch_indicators_command(mocker):
    global bundle_index
    global submitted_indicators

    mocker.patch.object(demisto, 'params', return_value=init_params())
    mocker.patch('requests.sessions.Session.send', new=mocked_request)

    from Sixgill_Darkfeed import fetch_indicators_command
    from sixgill.sixgill_feed_client import SixgillFeedClient
    from sixgill.sixgill_constants import FeedStream

    client = SixgillFeedClient("client_id", "client_secret", "some_channel",
                               FeedStream.DARKFEED, demisto, 1000)

    output = fetch_indicators_command(client)

    bundle_index = 0
    submitted_indicators = 0

    assert output == expected_ioc_output