Skip to content

Commit

Permalink
[tests] Fix test failures with Python 3.12 openwisp#953
Browse files Browse the repository at this point in the history
Replaced assertEquals with assertEqual and assertDictContainsSubset with for loop to check all key-value pairs.

Fixes openwisp#953
  • Loading branch information
dee077 committed Dec 23, 2024
1 parent aa08611 commit 87598e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openwisp_controller/config/tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ def test_ip_fields_not_duplicated(self):
self.assertIsNone(c1.device.management_ip)
self.assertEqual(c2.device.management_ip, '192.168.1.99')
# other organization is not affected
self.assertEquals(c3.device.last_ip, '127.0.0.1')
self.assertEqual(c3.device.last_ip, '127.0.0.1')
self.assertEqual(c3.device.management_ip, '192.168.1.99')

with self.subTest('test interaction with DeviceChecksumView caching'):
Expand Down
3 changes: 2 additions & 1 deletion openwisp_controller/config/tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ def test_context_regression(self):
template_qs = Template.objects.filter(type='vpn')
self.assertEqual(template_qs.count(), 1)
t = template_qs.first()
self.assertDictContainsSubset(_original_context, t.get_context())
for key, value in _original_context.items():
self.assertEqual(t.get_context().get(key), value)
self.assertEqual(app_settings.CONTEXT, _original_context)

with self.subTest(
Expand Down

0 comments on commit 87598e3

Please sign in to comment.