From 8bcc020346a4cbf4f153f06a5b645099c6ce6894 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sat, 14 Sep 2024 21:16:00 +0200 Subject: [PATCH] ci: test with failing tests --- .../modules/test_public_cloud_config_info.py | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/tests/unit/plugins/modules/test_public_cloud_config_info.py b/tests/unit/plugins/modules/test_public_cloud_config_info.py index 89db23a..abd6109 100644 --- a/tests/unit/plugins/modules/test_public_cloud_config_info.py +++ b/tests/unit/plugins/modules/test_public_cloud_config_info.py @@ -180,40 +180,6 @@ class TestPublicCloudConfigInfoModule(unittest.TestCase): msg="Check mode: No changes made, would retrieve public cloud config.", ) - def test_network_timeout(self): - """ - Test behavior when a network timeout occurs. - """ - - set_module_args( - { - "api_token": "mock_api_token", - "account_id": "mock_account_id", - } - ) - - with patch.object(AnsibleModule, "fail_json", side_effect=fail_json): - with pytest.raises(SystemExit) as e: - public_cloud_config_info.main() - # Simulate a network timeout error - mock_client_instance = MagicMock() - mock_client_instance.get.side_effect = Exception("Request timeout") - mock_client_class.return_value = mock_client_instance - - # Mock AnsibleModule parameters - mock_module_instance = MagicMock() - mock_module_instance.params = { - "api_token": "mock_api_token", - "account_id": "mock_account_id", - } - mock_ansible_module.return_value = mock_module_instance - - # Execute the run_module function - public_cloud_config_info.run_module() - - # Assert fail_json is called with the timeout error message - mock_module_instance.fail_json.assert_called_once_with(msg="Request timeout") - @patch( "ansible_collections.ednz_cloud.infomaniak.plugins.modules.public_cloud_config_info.InfomaniakAPIClient" ) @@ -241,7 +207,7 @@ class TestPublicCloudConfigInfoModule(unittest.TestCase): captured_output = json.loads(e.value.args[0]) assert "msg" in captured_output - assert captured_output["msg"] == "Request timeout" + assert not captured_output["msg"] == "Request timeout" mock_fail_json.assert_called_once() @patch(