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)
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({})
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)
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")
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")