@@ -80,7 +80,7 @@ def test_finding_queries(self, mock_timezone):
8080 mock_timezone .return_value = mock_datetime
8181
8282 # Queries over Finding
83- with self .assertNumQueries (28 ):
83+ with self .assertNumQueries (29 ):
8484 product_types = []
8585 finding_queries = utils .finding_queries (
8686 product_types ,
@@ -113,10 +113,12 @@ def test_finding_queries(self, mock_timezone):
113113 finding_queries ["accepted_count" ],
114114 {"total" : 3 , "critical" : 0 , "high" : 3 , "medium" : 0 , "low" : 0 , "info" : 0 },
115115 )
116- self .assertSequenceEqual (
117- finding_queries ["top_ten" ].values (),
118- [],
119- )
116+ self .assertIsInstance (finding_queries ["top_ten" ], list )
117+ for row in finding_queries ["top_ten" ]:
118+ self .assertSetEqual (
119+ set (row .keys ()),
120+ {"id" , "name" , "critical" , "high" , "medium" , "low" , "info" , "total" },
121+ )
120122 self .assertEqual (
121123 finding_queries ["monthly_counts" ],
122124 {
@@ -192,7 +194,7 @@ def test_endpoint_queries(self, mock_now):
192194 mock_now .return_value = fake_now
193195
194196 # Queries over Finding and Endpoint_Status
195- with self .assertNumQueries (44 ):
197+ with self .assertNumQueries (45 ):
196198 product_types = Product_Type .objects .all ()
197199 endpoint_queries = utils .endpoint_queries (
198200 product_types ,
@@ -245,10 +247,12 @@ def test_endpoint_queries(self, mock_now):
245247 list (endpoint_queries ["accepted_count" ].values ()),
246248 [1 , 0 , 0 , 0 , 0 , 1 ],
247249 )
248- self .assertSequenceEqual (
249- endpoint_queries ["top_ten" ].values (),
250- [],
251- )
250+ self .assertIsInstance (endpoint_queries ["top_ten" ], list )
251+ for row in endpoint_queries ["top_ten" ]:
252+ self .assertSetEqual (
253+ set (row .keys ()),
254+ {"id" , "name" , "critical" , "high" , "medium" , "low" , "info" , "total" },
255+ )
252256 self .assertEqual (
253257 list (endpoint_queries ["monthly_counts" ].values ()),
254258 [
0 commit comments