Skip to content

Commit

Permalink
Merge pull request #4322 from bruntib/deprecated_assertion
Browse files Browse the repository at this point in the history
[test] The assertDictContainsSubset() is depreceted and removed
  • Loading branch information
bruntib authored Aug 22, 2024
2 parents 9ef5a34 + 1fe094e commit b843db0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions web/tests/functional/authentication/test_permission_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ def test_get_access_control_with_permission_viewer(self):
self.assertTrue(len(permissions), 1)
self.assertIn("PERMISSION_VIEW", permissions)

self.assertDictContainsSubset(
{'permission_view_group': ['PERMISSION_VIEW']},
global_permissions.group)
self.assertLessEqual(
{'permission_view_group': ['PERMISSION_VIEW']}.items(),
global_permissions.group.items())

product_permissions = access_control.productPermissions
self.assertTrue(product_permissions)

auth_product_permissions = product_permissions["authentication"]
self.assertDictContainsSubset(
self.assertLessEqual(
{'cc': ['PRODUCT_STORE'],
'john': ['PRODUCT_STORE'],
'admin': ['PRODUCT_ADMIN']},
auth_product_permissions.user)
'admin': ['PRODUCT_ADMIN']}.items(),
auth_product_permissions.user.items())

# Previously, the test files in this directory interfered at one
# another, and the group permission dict wasn't empty. Check git blame.
Expand Down
4 changes: 2 additions & 2 deletions web/tests/functional/diff_remote/test_diff_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def test_get_diff_checker_counts_core_unresolved(self):

# Unresolved core checkers.
test_res = {'core.StackAddressEscape': 3, 'core.DivideZero': 10}
self.assertDictContainsSubset(test_res, diff_dict)
self.assertLessEqual(test_res.items(), diff_dict.items())

def test_get_diff_res_count_unresolved(self):
"""
Expand Down Expand Up @@ -574,7 +574,7 @@ def test_get_diff_checker_counts_all_unresolved(self):
'deadcode.DeadStores': 6,
'core.StackAddressEscape': 3,
'core.DivideZero': 10}
self.assertDictContainsSubset(diff_dict, test_res)
self.assertLessEqual(diff_dict.items(), test_res.items())

def test_get_diff_severity_counts_all_unresolved(self):
"""
Expand Down
10 changes: 5 additions & 5 deletions web/tests/functional/report_viewer_api/test_report_counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_run1_all_checkers(self):
checkers_dict = dict((res.name, res.count) for res in checker_counts)

self.assertGreaterEqual(len(checker_counts), len(self.run1_checkers))
self.assertDictContainsSubset(self.run1_checkers, checkers_dict)
self.assertLessEqual(self.run1_checkers.items(), checkers_dict.items())

def test_run1_core_checkers(self):
"""
Expand All @@ -167,7 +167,7 @@ def test_run1_core_checkers(self):
if "core." in k}

self.assertGreaterEqual(len(checker_counts), len(core_checkers))
self.assertDictContainsSubset(core_checkers, checkers_dict)
self.assertLessEqual(core_checkers.items(), checkers_dict.items())

def test_run2_all_checkers(self):
"""
Expand All @@ -182,7 +182,7 @@ def test_run2_all_checkers(self):
checkers_dict = dict((res.name, res.count) for res in checker_counts)

self.assertGreaterEqual(len(checker_counts), len(self.run2_checkers))
self.assertDictContainsSubset(self.run2_checkers, checkers_dict)
self.assertLessEqual(self.run2_checkers.items(), checkers_dict.items())

def test_run1_run2_all_checkers(self):
"""
Expand Down Expand Up @@ -225,7 +225,7 @@ def test_run1_run2_core_checkers(self):
all_core = dict(r1_core + r2_core)

self.assertGreaterEqual(len(checker_counts), len(all_core))
self.assertDictContainsSubset(all_core, checkers_dict)
self.assertLessEqual(all_core.items(), checkers_dict.items())

def test_run1_all_severity(self):
"""
Expand Down Expand Up @@ -368,7 +368,7 @@ def test_run1_run2_file_filters(self):
Counter(stack_r1) + Counter(stack_r2))

self.assertGreaterEqual(len(res), len(test_res))
self.assertDictContainsSubset(test_res, res)
self.assertLessEqual(test_res.items(), res.items())

def test_run1_run2_all_checker_msg(self):
"""
Expand Down

0 comments on commit b843db0

Please sign in to comment.