@@ -16,7 +16,9 @@ def setUp(self):
1616 domaintools_iris_result = iris_investigate_data .domaintools ()
1717 int_chase_iris_result = iris_investigate_data .int_chase ()
1818
19- test_results = {"results" : domaintools_iris_result ["results" ] + int_chase_iris_result ["results" ]}
19+ self .results = domaintools_iris_result ["results" ] + int_chase_iris_result ["results" ]
20+
21+ test_results = {"results" : self .results }
2022
2123 self .dt_res_filter = DTResultFilter (result_set = test_results )
2224
@@ -33,6 +35,32 @@ def test_filter_by_riskscore(self):
3335 assert len (result ) == 1
3436 assert result [0 ]["domain" ] == "int-chase.com"
3537
38+ def test_filter_by_riskscore_skips_results_without_risk_score (self ):
39+ """Test that results carrying no usable risk score are skipped instead of raising"""
40+ risk_score_threshold = 69
41+
42+ scoreless_results = {
43+ "results" : self .results
44+ + [
45+ {"domain" : "no-domain-risk.com" },
46+ {"domain" : "null-domain-risk.com" , "domain_risk" : None },
47+ {
48+ "domain" : "no-risk-score.com" ,
49+ "domain_risk" : {"components" : [{"name" : "zerolist" , "risk_score" : 0 }]},
50+ },
51+ {"domain" : "null-risk-score.com" , "domain_risk" : {"risk_score" : None }},
52+ ]
53+ }
54+
55+ result = DTResultFilter (result_set = scoreless_results ).by (
56+ [
57+ filter_by_riskscore (threshold = risk_score_threshold ),
58+ ]
59+ )
60+
61+ assert len (result ) == 1
62+ assert result [0 ]["domain" ] == "int-chase.com"
63+
3664 def test_filter_younger_than_expire_date (self ):
3765 """Test filter result younger than the expire date"""
3866 younger_than = "2024-02-24"
0 commit comments