From fdceb7e1944cdade4971fe52a06adcb098bc84c3 Mon Sep 17 00:00:00 2001 From: Rama Venkata Loya Date: Tue, 24 Sep 2024 15:23:27 +0530 Subject: [PATCH] updated the unit test inorder to support python 3.12 --- tests/sanity/ignore-devel.txt | 4 ++++ tests/unit/plugins/lookup/test_conjur_variable.py | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 tests/sanity/ignore-devel.txt diff --git a/tests/sanity/ignore-devel.txt b/tests/sanity/ignore-devel.txt new file mode 100644 index 00000000..b57dd581 --- /dev/null +++ b/tests/sanity/ignore-devel.txt @@ -0,0 +1,4 @@ +Jenkinsfile shebang +plugins/lookup/conjur_variable.py validate-modules:version-added-must-be-major-or-minor +dev/policy/root.yml yamllint:unparsable-with-libyaml # File loaded by Conjur server, not via Python +secrets.yml yamllint:unparsable-with-libyaml # File loaded by Summon, not via Python diff --git a/tests/unit/plugins/lookup/test_conjur_variable.py b/tests/unit/plugins/lookup/test_conjur_variable.py index c78704e8..27963a11 100644 --- a/tests/unit/plugins/lookup/test_conjur_variable.py +++ b/tests/unit/plugins/lookup/test_conjur_variable.py @@ -27,15 +27,15 @@ def test_merge_dictionaries(self): {}, {'id': 'host/ansible/ansible-fake', 'api_key': 'fakekey'} ) - self.assertEquals(MockMergeDictionaries.RESPONSE, functionOutput) + self.assertEqual(MockMergeDictionaries.RESPONSE, functionOutput) def test_load_identity_from_file(self): load_identity = _load_identity_from_file("/etc/conjur.identity", "https://conjur-fake") - self.assertEquals(MockFileload.RESPONSE, load_identity) + self.assertEqual(MockFileload.RESPONSE, load_identity) def test_load_conf_from_file(self): load_conf = _load_conf_from_file("/etc/conjur.conf") - self.assertEquals(MockFileload.RESPONSE, load_conf) + self.assertEqual(MockFileload.RESPONSE, load_conf) @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable.open_url') def test_fetch_conjur_token(self, mock_open_url): @@ -49,7 +49,7 @@ def test_fetch_conjur_token(self, mock_open_url): method="POST", validate_certs=True, ca_path="cert_file") - self.assertEquals("response body", result) + self.assertEqual("response body", result) @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._repeat_open_url') def test_fetch_conjur_variable(self, mock_repeat_open_url): @@ -63,7 +63,7 @@ def test_fetch_conjur_variable(self, mock_repeat_open_url): method="GET", validate_certs=True, ca_path="cert_file") - self.assertEquals(['response body'], result) + self.assertEqual(['response body'], result) @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_variable') @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_token') @@ -80,7 +80,7 @@ def test_run(self, mock_merge_dictionaries, mock_fetch_conjur_token, mock_fetch_ kwargs = {'as_file': False, 'conf_file': 'conf_file', 'validate_certs': False} result = self.lookup.run(terms, **kwargs) - self.assertEquals(result, ["conjur_variable"]) + self.assertEqual(result, ["conjur_variable"]) @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_variable') @patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_token')