コード例 #1
0
def test_cyren_feed_relationship_allowed_columns(indicator, columns):
    """
    Given: an indicator and supported columns
    When: Running cyren_feed_relationship command.
    Then: no ValueError is raised
    """
    from CyrenThreatInDepthRenderRelated import cyren_feed_relationship

    args = dict(indicator=indicator, columns=columns)
    cyren_feed_relationship(args)
コード例 #2
0
def test_cyren_feed_relationship_no_indicator():
    """
    Given: no indicator
    When: Running cyren_feed_relationship command.
    Then: ValueError is raised
    """
    from CyrenThreatInDepthRenderRelated import cyren_feed_relationship

    with pytest.raises(ValueError):
        cyren_feed_relationship({})
コード例 #3
0
def test_cyren_feed_relationship_wrong_columns(indicator, columns):
    """
    Given: an indicator but unsupported columns
    When: Running cyren_feed_relationship command.
    Then: ValueError is raised
    """
    from CyrenThreatInDepthRenderRelated import cyren_feed_relationship

    args = dict(indicator=indicator, columns=columns)
    with pytest.raises(ValueError):
        cyren_feed_relationship(args)
コード例 #4
0
def test_cyren_feed_relationship_without_search_response(mocker, indicator):
    """
    Given: File hash indicator.
    When: Running cyren_feed_relationship command.
    Then: Verify expected results returns
    """
    from CyrenThreatInDepthRenderRelated import cyren_feed_relationship

    args = dict(indicator=indicator)
    mocker.patch.object(demisto,
                        "searchIndicators",
                        return_value=SEARCH_INDICATORS_EMPTY_RESPONSE)
    result = cyren_feed_relationship(args)

    assert result.readable_output == (
        "|Indicator Type|Value|Reputation|Relationship Type|Entity Category|Timestamp UTC|\n"
        "|---|---|---|---|---|---|\n"
        "| SHA-256 | 0f6dbfb291ba1b84601b0372f70db3430df636c631d074c1c2463f9e5a033f21<br> | "
        "None (0) | downloaded from | malware | 2020-10-28, 14:45:24 |\n")
コード例 #5
0
def test_cyren_feed_relationship_with_search_response_other_columns(
        mocker, indicator):
    """
    Given: File hash indicator.
    When: Running cyren_feed_relationship command.
    Then: Verify expected results returns
    """
    from CyrenThreatInDepthRenderRelated import cyren_feed_relationship

    args = dict(indicator=indicator,
                columns="Relationship Type,Indicator Type")
    mocker.patch.object(demisto,
                        "searchIndicators",
                        return_value=SEARCH_INDICATORS_RESPONSE)
    result = cyren_feed_relationship(args)

    assert result.readable_output == ("|Relationship Type|Indicator Type|\n"
                                      "|---|---|\n"
                                      "| downloaded from | SHA-256 |\n")