@mock.patch('builtins.input', side_effect=['x', 5])
@mock.patch('tethys_apps.cli.install_commands.get_app_settings')
@mock.patch('tethys_apps.cli.cli_colors.pretty_output')
def test_interactive_custom_setting_set(self, mock_pretty_output, mock_get_settings, _):
    mock_cs = mock.MagicMock()
    mock_cs.name = 'mock_cs'
    mock_cs.save.side_effect = [ValidationError('error'), mock.DEFAULT]
    mock_get_settings.return_value = {'unlinked_settings': [mock_cs]}
    install_commands.run_interactive_services('foo')
    po_call_args = mock_pretty_output().__enter__().write.call_args_list
    self.assertIn('Configuring mock_cs', po_call_args[2][0][0])
    self.assertIn('Type', po_call_args[3][0][0])
    self.assertIn('Enter the desired value', po_call_args[4][0][0])
    self.assertIn('Incorrect value type', po_call_args[5][0][0])
    self.assertIn('Enter the desired value', po_call_args[6][0][0])
    self.assertEqual((mock_cs.name + ' successfully set with value: 5.'), po_call_args[7][0][0])
@mock.patch('builtins.input', side_effect=['x', 5])
@mock.patch('tethys_apps.cli.install_commands.get_app_settings')
@mock.patch('tethys_apps.cli.cli_colors.pretty_output')
def test_interactive_custom_setting_set(self, mock_pretty_output, mock_get_settings, _):
    mock_cs = mock.MagicMock()
    mock_cs.name = 'mock_cs'
    mock_cs.save.side_effect = [ValidationError('error'), mock.DEFAULT]
    mock_get_settings.return_value = {'unlinked_settings': [mock_cs]}
    install_commands.run_interactive_services('foo')
    po_call_args = mock_pretty_output().__enter__().write.call_args_list
    self.assertIn('Configuring mock_cs', po_call_args[2][0][0])
    self.assertIn('Type', po_call_args[3][0][0])
    self.assertIn('Enter the desired value', po_call_args[4][0][0])
    self.assertIn('Incorrect value type', po_call_args[5][0][0])
    self.assertIn('Enter the desired value', po_call_args[6][0][0])
    self.assertEqual((mock_cs.name + ' successfully set with value: 5.'), po_call_args[7][0][0])