'Test Tor Settings button clicked. With the given settings, see if we can
successfully connect and authenticate to Tor.'

def test_tor_clicked(self):

    common.log('SettingsDialog', 'test_tor_clicked')
    settings = self.settings_from_fields()
    try:
        if (settings.get('connection_type') == 'bundled'):
            self.tor_status.show()
            self._disable_buttons()
            def tor_status_update_func(progress, summary):
                self._tor_status_update(progress, summary)
                return True
        else:
            tor_status_update_func = None
        onion = Onion()
        onion.connect(settings=settings, config=self.config, tor_status_update_func=tor_status_update_func)
        Alert(strings._('settings_test_success', True).format(onion.tor_version, onion.supports_ephemeral, onion.supports_stealth))
        onion.cleanup()
    except (TorErrorInvalidSetting, TorErrorAutomatic, TorErrorSocketPort, TorErrorSocketFile, TorErrorMissingPassword, TorErrorUnreadableCookieFile, TorErrorAuthError, TorErrorProtocolError, BundledTorNotSupported, BundledTorTimeout) as e:
        Alert(e.args[0], QtWidgets.QMessageBox.Warning)
        if (settings.get('connection_type') == 'bundled'):
            self.tor_status.hide()
            self._enable_buttons()
