@mock.patch('tethys_apps.cli.install_commands.find_and_link')
@mock.patch('tethys_apps.cli.cli_colors.pretty_output')
@mock.patch('tethys_apps.models.CustomSetting')
def test_configure_services(self, mock_customsettings, mock_pretty_output, mock_find_and_link):
    app_name = 'foo'
    custom_service_name = 'custom_service_name'
    custom_setting_name = 'custom_setting_name'
    persistent_service_name = 'persistent_service_name'
    persistent_setting_name = 'persistent_setting_name'
    services = {'version': 1, 'custom_setting': {custom_setting_name: custom_service_name}, 'persistent': {persistent_setting_name: persistent_service_name}}
    mock_customsetting = mock.MagicMock(value=1)
    mock_customsetting.save.side_effect = ValidationError('error')
    mock_customsettings.objects.get.return_value = mock_customsetting
    install_commands.configure_services(services, app_name)
    po_call_args = mock_pretty_output().__enter__().write.call_args_list
    self.assertIn(f"Incorrect value type given for custom setting '{custom_setting_name}'", po_call_args[0][0][0])
    mock_find_and_link.assert_called_with('persistent', persistent_setting_name, persistent_service_name, app_name)
@mock.patch('tethys_apps.cli.install_commands.find_and_link')
@mock.patch('tethys_apps.cli.cli_colors.pretty_output')
@mock.patch('tethys_apps.models.CustomSetting')
def test_configure_services(self, mock_customsettings, mock_pretty_output, mock_find_and_link):
    app_name = 'foo'
    custom_service_name = 'custom_service_name'
    custom_setting_name = 'custom_setting_name'
    persistent_service_name = 'persistent_service_name'
    persistent_setting_name = 'persistent_setting_name'
    services = {'version': 1, 'custom_setting': {custom_setting_name: custom_service_name}, 'persistent': {persistent_setting_name: persistent_service_name}}
    mock_customsetting = mock.MagicMock(value=1)
    mock_customsetting.save.side_effect = ValidationError('error')
    mock_customsettings.objects.get.return_value = mock_customsetting
    install_commands.configure_services(services, app_name)
    po_call_args = mock_pretty_output().__enter__().write.call_args_list
    self.assertIn(f"Incorrect value type given for custom setting '{custom_setting_name}'", po_call_args[0][0][0])
    mock_find_and_link.assert_called_with('persistent', persistent_setting_name, persistent_service_name, app_name)