def test_output_full_changeset( self, mock_safe_dump: MagicMock, patched_format: MagicMock ) -> None: """Test output full changeset.""" get_input_path = "runway.cfngin.ui.get_raw_input" safe_dump_counter = 0 for v in ["y", "v", "Y", "V"]: with patch(get_input_path, return_value=v) as prompt: self.assertIsNone( output_full_changeset(full_changeset=[], params_diff=[], fqn=None) ) self.assertEqual(prompt.call_count, 1) safe_dump_counter += 1 self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 0) for v in ["n", "N"]: with patch(get_input_path, return_value=v) as prompt: output_full_changeset( full_changeset=[], params_diff=[], answer=None, fqn=None ) self.assertEqual(prompt.call_count, 1) self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 0) with self.assertRaises(exceptions.CancelExecution): output_full_changeset( full_changeset=[], params_diff=[], answer="x", fqn=None ) output_full_changeset( full_changeset=[], params_diff=[DictValue("mock", "", "")], answer="y", fqn=None, ) safe_dump_counter += 1 self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 1)
def test_output_full_changeset(self, mock_safe_dump, patched_format): """Test output full changeset.""" get_input_path = "runway.cfngin.ui.get_raw_input" safe_dump_counter = 0 for v in ['y', 'v', 'Y', 'V']: with patch(get_input_path, return_value=v) as prompt: self.assertIsNone( output_full_changeset(full_changeset=[], params_diff=[], fqn=None)) self.assertEqual(prompt.call_count, 1) safe_dump_counter += 1 self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 0) for v in ['n', 'N']: with patch(get_input_path, return_value=v) as prompt: output_full_changeset(full_changeset=[], params_diff=[], answer=None, fqn=None) self.assertEqual(prompt.call_count, 1) self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 0) with self.assertRaises(exceptions.CancelExecution): output_full_changeset(full_changeset=[], params_diff=[], answer='x', fqn=None) output_full_changeset(full_changeset=[], params_diff=['mock'], answer='y', fqn=None) safe_dump_counter += 1 self.assertEqual(mock_safe_dump.call_count, safe_dump_counter) self.assertEqual(patched_format.call_count, 1)