Replace deprecated assertDictContainsSubset

The method is deprecated since Python 3.2[1] and shows the following
DeprecationWarning.

/usr/lib/python3.9/unittest/case.py:1134: DeprecationWarning:
assertDictContainsSubset is deprecated
  warnings.warn('assertDictContainsSubset is deprecated',

[1] https://docs.python.org/3/whatsnew/3.2.html#unittest

Closes-Bug: #1938103
Change-Id: Ib1f000a7d5d0f94d7b844f8086a9798f28a44643
This commit is contained in:
Takashi Kajinami 2021-08-18 12:16:14 +09:00
parent 0b973a3cfe
commit 626c60fc30
2 changed files with 9 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class ApiV2TsigKeysTest(ApiV2TestCase):
self.assertIsNone(response.json['updated_at'])
# Check the supplied values returned are what we expect
self.assertDictContainsSubset(fixture, response.json)
self.assertLessEqual(fixture.items(), response.json.items())
def test_create_tsigkey_validation(self):
# NOTE: The schemas should be tested separately to the API. So we

View File

@ -2903,15 +2903,18 @@ class CentralServiceTest(CentralTestCase):
# Compare the actual values of attributes and ns_records
for k in range(0, len(values['attributes'])):
self.assertDictContainsSubset(
values['attributes'][k],
self.assertLessEqual(
values['attributes'][k].items(),
pool['attributes'][k].to_primitive()['designate_object.data']
.items()
)
for k in range(0, len(values['ns_records'])):
self.assertDictContainsSubset(
values['ns_records'][k],
pool['ns_records'][k].to_primitive()['designate_object.data'])
self.assertLessEqual(
values['ns_records'][k].items(),
pool['ns_records'][k].to_primitive()['designate_object.data']
.items()
)
def test_get_pool(self):
# Create a server pool