Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion unittests/test_metrics_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ def test_endpoint_queries(self, mock_now):

# Assert that we get expected querysets back. This is to be used to
# support refactoring, in attempt of lowering the query count.
self.assertSequenceEqual(

# https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertCountEqual
# Test that sequence first contains the same elements as second, regardless of their order. When they don't, an error message listing the differences between the sequences will be generated.
# Duplicate elements are not ignored when comparing first and second. It verifies whether each element has the same count in both sequences. Equivalent to: assertEqual(Counter(list(first)), Counter(list(second))) but works with sequences of unhashable objects as well.
self.assertCountEqual(
endpoint_queries["all"].values(),
[
{"id": 1, "date": date(2020, 7, 1), "last_modified": datetime(2020, 7, 1, 17, 45, 39, 791907, tzinfo=pytz.UTC), "mitigated": False, "mitigated_time": None, "mitigated_by_id": None, "false_positive": False, "out_of_scope": False, "risk_accepted": False, "endpoint_id": 2, "finding_id": 2, "endpoint__product__prod_type__member": False, "endpoint__product__member": True, "endpoint__product__prod_type__authorized_group": False, "endpoint__product__authorized_group": False},
Expand Down