@@ -1582,6 +1582,28 @@ def test_api_product_has_reachable_vulnerability_filter(self):
15821582 response = self .client .get (self .product_list_url , data )
15831583 self .assertEqual (0 , response .data ["count" ])
15841584
1585+ def test_api_product_has_reachable_vulnerability_filter_no_duplicates (self ):
1586+ self .client .login (username = "super_user" , password = "secret" )
1587+ vulnerability1 = make_vulnerability (self .dataspace , affecting = self .package1 )
1588+ vulnerability2 = make_vulnerability (self .dataspace , affecting = self .package1 )
1589+ make_vulnerability_analysis (self .pp1 , vulnerability1 , is_reachable = True )
1590+ make_vulnerability_analysis (self .pp1 , vulnerability2 , is_reachable = True )
1591+
1592+ data = {"has_reachable_vulnerability" : "true" }
1593+ response = self .client .get (self .product_list_url , data )
1594+ self .assertEqual (1 , response .data ["count" ])
1595+
1596+ def test_api_productpackage_has_reachable_vulnerability_filter_no_duplicates (self ):
1597+ self .client .login (username = "super_user" , password = "secret" )
1598+ vulnerability1 = make_vulnerability (self .dataspace , affecting = self .package1 )
1599+ vulnerability2 = make_vulnerability (self .dataspace , affecting = self .package1 )
1600+ make_vulnerability_analysis (self .pp1 , vulnerability1 , is_reachable = True )
1601+ make_vulnerability_analysis (self .pp1 , vulnerability2 , is_reachable = True )
1602+
1603+ data = {"has_reachable_vulnerability" : "true" }
1604+ response = self .client .get (self .productpackage_list_url , data )
1605+ self .assertEqual (1 , response .data ["count" ])
1606+
15851607 def test_api_codebaseresource_list_endpoint_results (self ):
15861608 self .client .login (username = "super_user" , password = "secret" )
15871609 response = self .client .get (self .codebase_resource_list_url )
0 commit comments