Skip to content

Commit 9557fe0

Browse files
committed
Add UT cases
Signed-off-by: Luis Liu <[email protected]>
1 parent a39875d commit 9557fe0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/unit/plugins/modules/test_info.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,30 @@ def test_get_facts_alert_settings_api_module(self, powerscale_module_mock, input
601601
assert MockGatherfactsApi.get_gather_facts_module_response(
602602
gather_subset) == powerscale_module_mock.module.exit_json.call_args[1][return_key]
603603

604+
@pytest.mark.parametrize("input_params", [
605+
{"gather_subset": "alert_settings", "return_key": "alert_settings"}
606+
]
607+
)
608+
def test_get_facts_alert_settings_api_911_module(self, powerscale_module_mock, input_params):
609+
"""Test the get_facts that uses the alert settings api endpoint to get the module response"""
610+
611+
gather_subset = input_params.get('gather_subset')
612+
return_key = input_params.get('return_key')
613+
api_response = MockGatherfactsApi.get_gather_facts_api_response(
614+
gather_subset)
615+
self.get_module_args.update({
616+
'gather_subset': ['alert_settings']
617+
})
618+
powerscale_module_mock.major = 9
619+
powerscale_module_mock.minor = 11
620+
powerscale_module_mock.module.params = self.get_module_args
621+
with patch.object(powerscale_module_mock.event_api,
622+
MockGatherfactsApi.get_gather_facts_error_method(gather_subset)) as mock_method:
623+
mock_method.return_value = MockSDKResponse(api_response)
624+
powerscale_module_mock.perform_module_operation()
625+
assert MockGatherfactsApi.get_gather_facts_module_response(
626+
gather_subset) == powerscale_module_mock.module.exit_json.call_args[1][return_key]
627+
604628
@pytest.mark.parametrize("gather_subset", ["alert_settings"])
605629
def test_get_facts_alert_settings_api_exception(self, powerscale_module_mock, gather_subset):
606630
"""Test the get_facts that uses the alert settings api endpoint to get the exception"""

0 commit comments

Comments
 (0)