mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
[PR #7348/6c9713b3 backport][stable-7] Fix Python 3.12 unit tests (#7351)
Fix Python 3.12 unit tests (#7348)
* Re-enable Python 3.12 unit tests.
* Stop using deprecated alias.
* Stop using long deprecated subset comparison function.
* Avoid another alias.
* Fix name, add Python 2 compatibility.
* Properly make backwards compatible.
(cherry picked from commit 6c9713b36c)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -20,9 +20,9 @@ class PagerDutyTest(unittest.TestCase):
|
||||
return object(), {'status': 200}
|
||||
|
||||
def _assert_ongoing_window_with_v1_compatible_header(self, module, url, headers, data=None, method=None):
|
||||
self.assertDictContainsSubset(
|
||||
{'Accept': 'application/vnd.pagerduty+json;version=2'},
|
||||
headers,
|
||||
self.assertEqual(
|
||||
'application/vnd.pagerduty+json;version=2',
|
||||
headers.get('Accept'),
|
||||
'Accept:application/vnd.pagerduty+json;version=2 HTTP header not found'
|
||||
)
|
||||
return object(), {'status': 200}
|
||||
@@ -36,17 +36,17 @@ class PagerDutyTest(unittest.TestCase):
|
||||
return object(), {'status': 201}
|
||||
|
||||
def _assert_create_a_maintenance_window_from_header(self, module, url, headers, data=None, method=None):
|
||||
self.assertDictContainsSubset(
|
||||
{'From': 'requester_id'},
|
||||
headers,
|
||||
self.assertEqual(
|
||||
'requester_id',
|
||||
headers.get('From'),
|
||||
'From:requester_id HTTP header not found'
|
||||
)
|
||||
return object(), {'status': 201}
|
||||
|
||||
def _assert_create_window_with_v1_compatible_header(self, module, url, headers, data=None, method=None):
|
||||
self.assertDictContainsSubset(
|
||||
{'Accept': 'application/vnd.pagerduty+json;version=2'},
|
||||
headers,
|
||||
self.assertEqual(
|
||||
'application/vnd.pagerduty+json;version=2',
|
||||
headers.get('Accept'),
|
||||
'Accept:application/vnd.pagerduty+json;version=2 HTTP header not found'
|
||||
)
|
||||
return object(), {'status': 201}
|
||||
@@ -89,9 +89,9 @@ class PagerDutyTest(unittest.TestCase):
|
||||
return object(), {'status': 204}
|
||||
|
||||
def _assert_absent_window_with_v1_compatible_header(self, module, url, headers, method=None):
|
||||
self.assertDictContainsSubset(
|
||||
{'Accept': 'application/vnd.pagerduty+json;version=2'},
|
||||
headers,
|
||||
self.assertEqual(
|
||||
'application/vnd.pagerduty+json;version=2',
|
||||
headers.get('Accept'),
|
||||
'Accept:application/vnd.pagerduty+json;version=2 HTTP header not found'
|
||||
)
|
||||
return object(), {'status': 204}
|
||||
|
||||
Reference in New Issue
Block a user