Update settings dialog tests to use an OnionStub instead of an Onion, and test different states of tor (authenticate and not, supports v3 and not)

This commit is contained in:
Micah Lee 2018-12-05 23:05:25 -08:00
parent 16e301af8d
commit 300434e5ec
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
7 changed files with 295 additions and 184 deletions

View file

@ -89,8 +89,8 @@ class SettingsDialog(QtWidgets.QDialog):
self.shutdown_timeout_widget.setLayout(shutdown_timeout_layout)
# Label telling user to connect to Tor for onion service settings
connect_to_tor_label = QtWidgets.QLabel(strings._("gui_connect_to_tor_for_onion_settings"))
connect_to_tor_label.setStyleSheet(self.common.css['settings_connect_to_tor'])
self.connect_to_tor_label = QtWidgets.QLabel(strings._("gui_connect_to_tor_for_onion_settings"))
self.connect_to_tor_label.setStyleSheet(self.common.css['settings_connect_to_tor'])
# Whether or not to use legacy v2 onions
self.use_legacy_v2_onions_checkbox = QtWidgets.QCheckBox()
@ -161,15 +161,15 @@ class SettingsDialog(QtWidgets.QDialog):
onion_settings_layout.addWidget(self.use_stealth_widget)
onion_settings_layout.addWidget(hidservauth_details)
onion_settings_layout.addWidget(self.hidservauth_copy_button)
onion_settings_widget = QtWidgets.QWidget()
onion_settings_widget.setLayout(onion_settings_layout)
self.onion_settings_widget = QtWidgets.QWidget()
self.onion_settings_widget.setLayout(onion_settings_layout)
# General options layout
general_group_layout = QtWidgets.QVBoxLayout()
general_group_layout.addWidget(self.public_mode_widget)
general_group_layout.addWidget(self.shutdown_timeout_widget)
general_group_layout.addWidget(connect_to_tor_label)
general_group_layout.addWidget(onion_settings_widget)
general_group_layout.addWidget(self.connect_to_tor_label)
general_group_layout.addWidget(self.onion_settings_widget)
general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label"))
general_group.setLayout(general_group_layout)
@ -471,7 +471,9 @@ class SettingsDialog(QtWidgets.QDialog):
self.setLayout(layout)
self.cancel_button.setFocus()
self.reload_settings()
def reload_settings(self):
# Load settings, and fill them in
self.old_settings = Settings(self.common, self.config)
self.old_settings.load()
@ -593,8 +595,8 @@ class SettingsDialog(QtWidgets.QDialog):
# If we're connected to Tor, show onion service settings, show label if not
if self.onion.is_authenticated():
connect_to_tor_label.hide()
onion_settings_widget.show()
self.connect_to_tor_label.hide()
self.onion_settings_widget.show()
# If v3 onion services are supported, allow using legacy mode
if self.onion.supports_v3_onions:
@ -605,8 +607,8 @@ class SettingsDialog(QtWidgets.QDialog):
self.use_legacy_v2_onions_widget.hide()
self.use_legacy_v2_onions_checkbox_clicked(True)
else:
connect_to_tor_label.show()
onion_settings_widget.hide()
self.connect_to_tor_label.show()
self.onion_settings_widget.hide()
def connection_type_bundled_toggled(self, checked):