def test_prepare(self, operations_to_normalized, normalized_to_operations, validate_operation_list, validate_different_intervals, complete_all_intervals, get_remaining_defaults): validate_operation_list.return_value = ["options_report"] validate_different_intervals.return_value = [ "different_interval_report" ] operations_to_normalized.return_value = [ { "name": ValuePair("Start", "start") }, { "name": ValuePair("Monitor", "monitor") }, ] normalized_to_operations.return_value = [ { "name": "start" }, { "name": "monitor" }, ] report_processor = mock.MagicMock() raw_operation_list = [ { "name": "Start" }, { "name": "Monitor" }, ] default_operation_list = [ { "name": "stop" }, ] allowed_operation_name_list = ["start", "stop", "monitor"] allow_invalid = True operations.prepare( report_processor, raw_operation_list, default_operation_list, allowed_operation_name_list, allow_invalid, ) operations_to_normalized.assert_called_once_with(raw_operation_list) normalized_to_operations.assert_called_once_with( operations_to_normalized.return_value) validate_operation_list.assert_called_once_with( operations_to_normalized.return_value, allowed_operation_name_list, allow_invalid) validate_different_intervals.assert_called_once_with( normalized_to_operations.return_value) complete_all_intervals.assert_called_once_with( normalized_to_operations.return_value) get_remaining_defaults.assert_called_once_with( report_processor, normalized_to_operations.return_value, default_operation_list) report_processor.process_list.assert_called_once_with([ "options_report", "different_interval_report", ])
def test_prepare( self, operations_to_normalized, normalized_to_operations, validate_operation_list, validate_different_intervals, complete_operations_options, get_remaining_defaults, ): new_role_names_supported = False validate_operation_list.return_value = ["options_report"] validate_different_intervals.return_value = [ "different_interval_report" ] operations_to_normalized.return_value = [ { "name": ValuePair("Start", "start") }, { "name": ValuePair("Monitor", "monitor") }, ] normalized_to_operations.return_value = [ { "name": "start" }, { "name": "monitor" }, ] report_processor = mock.MagicMock() report_processor.report_list.return_value = report_processor report_processor.has_errors = False raw_operation_list = [ { "name": "Start" }, { "name": "Monitor" }, ] default_operation_list = [{"name": "stop", "interval": "10s"}] completed_default_operation_list = [ { "name": "start", "interval": "0s" }, { "name": "monitor", "interval": "60s" }, ] allowed_operation_name_list = ["start", "stop", "monitor"] allow_invalid = True complete_operations_options.return_value = ( completed_default_operation_list) operations.prepare( report_processor, raw_operation_list, default_operation_list, allowed_operation_name_list, new_role_names_supported, allow_invalid, ) operations_to_normalized.assert_called_once_with(raw_operation_list) normalized_to_operations.assert_called_once_with( operations_to_normalized.return_value, new_role_names_supported) validate_operation_list.assert_called_once_with( operations_to_normalized.return_value, allowed_operation_name_list, allow_invalid, ) validate_different_intervals.assert_called_once_with( normalized_to_operations.return_value) complete_operations_options.assert_has_calls( [mock.call(normalized_to_operations.return_value)]) get_remaining_defaults.assert_called_once_with( normalized_to_operations.return_value, default_operation_list, ) report_processor.report_list.assert_has_calls([ mock.call(["options_report", "different_interval_report"]), mock.call([]), ])