mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix CI (#3637)
* Replace yaml.load with yaml.safe_load in unit tests. * Remove no longer needed loader arg in two instances.
This commit is contained in:
parent
3b82a6ff99
commit
753df78877
2 changed files with 8 additions and 8 deletions
|
@ -38,7 +38,7 @@ class OneViewBaseTest(object):
|
||||||
testing_module = getattr(oneview_module, testing_module)
|
testing_module = getattr(oneview_module, testing_module)
|
||||||
try:
|
try:
|
||||||
# Load scenarios from module examples (Also checks if it is a valid yaml)
|
# Load scenarios from module examples (Also checks if it is a valid yaml)
|
||||||
EXAMPLES = yaml.load(testing_module.EXAMPLES, yaml.SafeLoader)
|
EXAMPLES = yaml.safe_load(testing_module.EXAMPLES)
|
||||||
|
|
||||||
except yaml.scanner.ScannerError:
|
except yaml.scanner.ScannerError:
|
||||||
message = "Something went wrong while parsing yaml from {0}.EXAMPLES".format(self.testing_class.__module__)
|
message = "Something went wrong while parsing yaml from {0}.EXAMPLES".format(self.testing_class.__module__)
|
||||||
|
@ -140,7 +140,7 @@ class OneViewBaseTestCase(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Load scenarios from module examples (Also checks if it is a valid yaml)
|
# Load scenarios from module examples (Also checks if it is a valid yaml)
|
||||||
self.EXAMPLES = yaml.load(self.testing_module.EXAMPLES, yaml.SafeLoader)
|
self.EXAMPLES = yaml.safe_load(self.testing_module.EXAMPLES)
|
||||||
|
|
||||||
except yaml.scanner.ScannerError:
|
except yaml.scanner.ScannerError:
|
||||||
message = "Something went wrong while parsing yaml from {0}.EXAMPLES".format(self.testing_class.__module__)
|
message = "Something went wrong while parsing yaml from {0}.EXAMPLES".format(self.testing_class.__module__)
|
||||||
|
|
|
@ -132,7 +132,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
self.resource.update.return_value = data_merged
|
self.resource.update.return_value = data_merged
|
||||||
self.mock_ov_client.connection_templates.get.return_value = {"uri": "uri"}
|
self.mock_ov_client.connection_templates.get.return_value = {"uri": "uri"}
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_PARAMS_WITH_CHANGES)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_PARAMS_WITH_CHANGES)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
self.resource.get_by.return_value = [DICT_PARAMS_WITH_CHANGES]
|
self.resource.get_by.return_value = [DICT_PARAMS_WITH_CHANGES]
|
||||||
self.mock_ov_client.connection_templates.get.return_value = {"uri": "uri"}
|
self.mock_ov_client.connection_templates.get.return_value = {"uri": "uri"}
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_PARAMS_WITH_CHANGES)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_PARAMS_WITH_CHANGES)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
self.mock_ov_client.connection_templates.get.return_value = {
|
self.mock_ov_client.connection_templates.get.return_value = {
|
||||||
"bandwidth": DICT_PARAMS_WITH_CHANGES['bandwidth']}
|
"bandwidth": DICT_PARAMS_WITH_CHANGES['bandwidth']}
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_PARAMS_WITH_CHANGES)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_PARAMS_WITH_CHANGES)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
self.resource.get_by.return_value = [DEFAULT_ENET_TEMPLATE]
|
self.resource.get_by.return_value = [DEFAULT_ENET_TEMPLATE]
|
||||||
self.resource.update.return_value = data_merged
|
self.resource.update.return_value = data_merged
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_PARAMS_WITH_CHANGES)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_PARAMS_WITH_CHANGES)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
"max": 1
|
"max": 1
|
||||||
}}
|
}}
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_RESET_CONNECTION_TEMPLATE)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_RESET_CONNECTION_TEMPLATE)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class EthernetNetworkModuleSpec(unittest.TestCase,
|
||||||
def test_should_fail_when_reset_not_existing_ethernet_network(self):
|
def test_should_fail_when_reset_not_existing_ethernet_network(self):
|
||||||
self.resource.get_by.return_value = [None]
|
self.resource.get_by.return_value = [None]
|
||||||
|
|
||||||
self.mock_ansible_module.params = yaml.load(YAML_RESET_CONNECTION_TEMPLATE)
|
self.mock_ansible_module.params = yaml.safe_load(YAML_RESET_CONNECTION_TEMPLATE)
|
||||||
|
|
||||||
EthernetNetworkModule().run()
|
EthernetNetworkModule().run()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue