diff --git a/tests/SettingsGuiBaseTest.py b/tests/SettingsGuiBaseTest.py new file mode 100644 index 00000000..dac074fc --- /dev/null +++ b/tests/SettingsGuiBaseTest.py @@ -0,0 +1,49 @@ +import json +import os +import sys +from PyQt5 import QtWidgets + +from onionshare import strings +from onionshare.common import Common +from onionshare.settings import Settings +from onionshare.onion import Onion +from onionshare.web import Web +from onionshare_gui import Application, OnionShare +from onionshare_gui.settings_dialog import SettingsDialog + +class SettingsGuiBaseTest(object): + @staticmethod + def set_up(test_settings, settings_filename): + '''Create the GUI''' + # Create our test file + testfile = open('/tmp/test.txt', 'w') + testfile.write('onionshare') + testfile.close() + + common = Common() + common.settings = Settings(common) + common.define_css() + strings.load_strings(common) + + # Start the Onion + testonion = Onion(common) + global qtapp + qtapp = Application(common) + app = OnionShare(common, testonion, True, 0) + + web = Web(common, False, True) + + for key, val in common.settings.default_settings.items(): + if key not in test_settings: + test_settings[key] = val + + open('/tmp/{}.json'.format(settings_filename), 'w').write(json.dumps(test_settings)) + + gui = SettingsDialog(common, testonion, qtapp, '/tmp/{}.json'.format(settings_filename), True) + return gui + + + @staticmethod + def tear_down(): + '''Clean up after tests''' + os.remove('/tmp/settings.json') diff --git a/tests/local_onionshare_404_public_mode_skips_ratelimit_test.py b/tests/local_onionshare_404_public_mode_skips_ratelimit_test.py index e4e0a03f..c4c271b8 100644 --- a/tests/local_onionshare_404_public_mode_skips_ratelimit_test.py +++ b/tests/local_onionshare_404_public_mode_skips_ratelimit_test.py @@ -12,6 +12,10 @@ class Local404PublicModeRateLimitTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'Local404PublicModeRateLimitTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_tests(True, True) diff --git a/tests/local_onionshare_404_triggers_ratelimit_test.py b/tests/local_onionshare_404_triggers_ratelimit_test.py index ce26eae1..8f9caa7c 100644 --- a/tests/local_onionshare_404_triggers_ratelimit_test.py +++ b/tests/local_onionshare_404_triggers_ratelimit_test.py @@ -11,6 +11,10 @@ class Local404RateLimitTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'Local404RateLimitTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_tests(False, True) diff --git a/tests/local_onionshare_receive_mode_sender_closed_test.py b/tests/local_onionshare_receive_mode_sender_closed_test.py index 6960301a..1f16b5fb 100644 --- a/tests/local_onionshare_receive_mode_sender_closed_test.py +++ b/tests/local_onionshare_receive_mode_sender_closed_test.py @@ -11,6 +11,10 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest): } cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest') + @classmethod + def tearDownClass(cls): + GuiReceiveTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_receive_mode_tests(False, True) diff --git a/tests/local_onionshare_receive_mode_timer_test.py b/tests/local_onionshare_receive_mode_timer_test.py index 1784ba94..039acff4 100644 --- a/tests/local_onionshare_receive_mode_timer_test.py +++ b/tests/local_onionshare_receive_mode_timer_test.py @@ -12,6 +12,10 @@ class LocalReceiveModeTimerTest(unittest.TestCase, GuiReceiveTest): } cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTimerTest') + @classmethod + def tearDownClass(cls): + GuiReceiveTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_receive_mode_timer_tests(False) diff --git a/tests/local_onionshare_receive_mode_upload_non_writable_dir_test.py b/tests/local_onionshare_receive_mode_upload_non_writable_dir_test.py index e33a6461..ee3a7215 100644 --- a/tests/local_onionshare_receive_mode_upload_non_writable_dir_test.py +++ b/tests/local_onionshare_receive_mode_upload_non_writable_dir_test.py @@ -11,6 +11,10 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest): } cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest') + @classmethod + def tearDownClass(cls): + GuiReceiveTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_receive_mode_unwritable_dir_tests(False, True) diff --git a/tests/local_onionshare_receive_mode_upload_public_mode_test.py b/tests/local_onionshare_receive_mode_upload_public_mode_test.py index 2c7cbd5e..654895ca 100644 --- a/tests/local_onionshare_receive_mode_upload_public_mode_test.py +++ b/tests/local_onionshare_receive_mode_upload_public_mode_test.py @@ -12,6 +12,10 @@ class LocalReceiveModePublicModeTest(unittest.TestCase, GuiReceiveTest): } cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModePublicModeTest') + @classmethod + def tearDownClass(cls): + GuiReceiveTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_receive_mode_tests(True, True) diff --git a/tests/local_onionshare_receive_mode_upload_test.py b/tests/local_onionshare_receive_mode_upload_test.py index fb5d36a7..c06d30cd 100644 --- a/tests/local_onionshare_receive_mode_upload_test.py +++ b/tests/local_onionshare_receive_mode_upload_test.py @@ -11,6 +11,10 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest): } cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest') + @classmethod + def tearDownClass(cls): + GuiReceiveTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_receive_mode_tests(False, True) diff --git a/tests/local_onionshare_settings_dialog_test.py b/tests/local_onionshare_settings_dialog_test.py new file mode 100644 index 00000000..64840d7d --- /dev/null +++ b/tests/local_onionshare_settings_dialog_test.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python3 +import json +import unittest +from PyQt5 import QtCore, QtTest + +from onionshare import strings +from .SettingsGuiBaseTest import SettingsGuiBaseTest + +class SettingsGuiTest(unittest.TestCase, SettingsGuiBaseTest): + @classmethod + def setUpClass(cls): + test_settings = { + "no_bridges": False, + "tor_bridges_use_obfs4": True, + } + cls.gui = SettingsGuiBaseTest.set_up(test_settings, 'settings') + + @classmethod + def tearDownClass(cls): + SettingsGuiBaseTest.tear_down() + + def test_gui(self): + self.gui.show() + # Window is shown + self.assertTrue(self.gui.isVisible()) + self.assertEqual(self.gui.windowTitle(), strings._('gui_settings_window_title')) + # Check for updates button is hidden + self.assertFalse(self.gui.check_for_updates_button.isVisible()) + + # public mode is off + self.assertFalse(self.gui.public_mode_checkbox.isChecked()) + # enable public mode + QtTest.QTest.mouseClick(self.gui.public_mode_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.public_mode_checkbox.height()/2)) + self.assertTrue(self.gui.public_mode_checkbox.isChecked()) + + # shutdown timer is off + self.assertFalse(self.gui.shutdown_timeout_checkbox.isChecked()) + # enable shutdown timer + QtTest.QTest.mouseClick(self.gui.shutdown_timeout_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.shutdown_timeout_checkbox.height()/2)) + self.assertTrue(self.gui.shutdown_timeout_checkbox.isChecked()) + + # legacy mode checkbox and related widgets + # legacy mode is off + self.assertFalse(self.gui.use_legacy_v2_onions_checkbox.isChecked()) + # persistence, stealth is hidden and disabled + self.assertFalse(self.gui.save_private_key_widget.isVisible()) + self.assertFalse(self.gui.save_private_key_checkbox.isChecked()) + self.assertFalse(self.gui.use_stealth_widget.isVisible()) + self.assertFalse(self.gui.stealth_checkbox.isChecked()) + self.assertFalse(self.gui.hidservauth_copy_button.isVisible()) + + # enable legacy mode + QtTest.QTest.mouseClick(self.gui.use_legacy_v2_onions_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.use_legacy_v2_onions_checkbox.height()/2)) + self.assertTrue(self.gui.use_legacy_v2_onions_checkbox.isChecked()) + self.assertTrue(self.gui.save_private_key_checkbox.isVisible()) + self.assertTrue(self.gui.use_stealth_widget.isVisible()) + # enable persistent mode + QtTest.QTest.mouseClick(self.gui.save_private_key_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.save_private_key_checkbox.height()/2)) + self.assertTrue(self.gui.save_private_key_checkbox.isChecked()) + # enable stealth mode + QtTest.QTest.mouseClick(self.gui.stealth_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.stealth_checkbox.height()/2)) + self.assertTrue(self.gui.stealth_checkbox.isChecked()) + # now that stealth, persistence are enabled, we can't turn off legacy mode + self.assertFalse(self.gui.use_legacy_v2_onions_checkbox.isEnabled()) + # disable stealth, persistence + QtTest.QTest.mouseClick(self.gui.save_private_key_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.save_private_key_checkbox.height()/2)) + QtTest.QTest.mouseClick(self.gui.stealth_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.stealth_checkbox.height()/2)) + # legacy mode checkbox is enabled again + self.assertTrue(self.gui.use_legacy_v2_onions_checkbox.isEnabled()) + # uncheck legacy mode + QtTest.QTest.mouseClick(self.gui.use_legacy_v2_onions_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.use_legacy_v2_onions_checkbox.height()/2)) + # legacy options hidden again + self.assertFalse(self.gui.save_private_key_widget.isVisible()) + self.assertFalse(self.gui.use_stealth_widget.isVisible()) + # enable them all again so that we can see the setting stick in settings.json + QtTest.QTest.mouseClick(self.gui.use_legacy_v2_onions_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.use_legacy_v2_onions_checkbox.height()/2)) + QtTest.QTest.mouseClick(self.gui.save_private_key_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.save_private_key_checkbox.height()/2)) + QtTest.QTest.mouseClick(self.gui.stealth_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.stealth_checkbox.height()/2)) + + + # stay open toggled off, on + self.assertTrue(self.gui.close_after_first_download_checkbox.isChecked()) + QtTest.QTest.mouseClick(self.gui.close_after_first_download_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.close_after_first_download_checkbox.height()/2)) + self.assertFalse(self.gui.close_after_first_download_checkbox.isChecked()) + + # receive mode + self.gui.downloads_dir_lineedit.setText('/tmp/OnionShareSettingsTest') + # allow receiver shutdown is on + self.assertTrue(self.gui.receive_allow_receiver_shutdown_checkbox.isChecked()) + # disable receiver shutdown + QtTest.QTest.mouseClick(self.gui.receive_allow_receiver_shutdown_checkbox, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.receive_allow_receiver_shutdown_checkbox.height()/2)) + self.assertFalse(self.gui.receive_allow_receiver_shutdown_checkbox.isChecked()) + + + # bundled mode is enabled + self.assertTrue(self.gui.connection_type_bundled_radio.isEnabled()) + self.assertTrue(self.gui.connection_type_bundled_radio.isChecked()) + # bridge options are shown + self.assertTrue(self.gui.connection_type_bridges_radio_group.isVisible()) + # bridges are set to obfs4 + self.assertFalse(self.gui.tor_bridges_no_bridges_radio.isChecked()) + self.assertTrue(self.gui.tor_bridges_use_obfs4_radio.isChecked()) + + # custom bridges are hidden + self.assertFalse(self.gui.tor_bridges_use_custom_textbox_options.isVisible()) + # other modes are unchecked but enabled + self.assertTrue(self.gui.connection_type_automatic_radio.isEnabled()) + self.assertTrue(self.gui.connection_type_control_port_radio.isEnabled()) + self.assertTrue(self.gui.connection_type_socket_file_radio.isEnabled()) + self.assertFalse(self.gui.connection_type_automatic_radio.isChecked()) + self.assertFalse(self.gui.connection_type_control_port_radio.isChecked()) + self.assertFalse(self.gui.connection_type_socket_file_radio.isChecked()) + + # enable automatic mode + QtTest.QTest.mouseClick(self.gui.connection_type_automatic_radio, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.connection_type_automatic_radio.height()/2)) + self.assertTrue(self.gui.connection_type_automatic_radio.isChecked()) + # bundled is off + self.assertFalse(self.gui.connection_type_bundled_radio.isChecked()) + # bridges are hidden + self.assertFalse(self.gui.connection_type_bridges_radio_group.isVisible()) + + # auth type is hidden in bundled or automatic mode + self.assertFalse(self.gui.authenticate_no_auth_radio.isVisible()) + self.assertFalse(self.gui.authenticate_password_radio.isVisible()) + + # enable control port mode + QtTest.QTest.mouseClick(self.gui.connection_type_control_port_radio, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.connection_type_control_port_radio.height()/2)) + self.assertTrue(self.gui.connection_type_control_port_radio.isChecked()) + # automatic is off + self.assertFalse(self.gui.connection_type_automatic_radio.isChecked()) + # auth options appear + self.assertTrue(self.gui.authenticate_no_auth_radio.isVisible()) + self.assertTrue(self.gui.authenticate_password_radio.isVisible()) + + # enable socket mode + QtTest.QTest.mouseClick(self.gui.connection_type_socket_file_radio, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.connection_type_socket_file_radio.height()/2)) + self.assertTrue(self.gui.connection_type_socket_file_radio.isChecked()) + # control port is off + self.assertFalse(self.gui.connection_type_control_port_radio.isChecked()) + # auth options are still present + self.assertTrue(self.gui.authenticate_no_auth_radio.isVisible()) + self.assertTrue(self.gui.authenticate_password_radio.isVisible()) + + # re-enable bundled mode + QtTest.QTest.mouseClick(self.gui.connection_type_bundled_radio, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.connection_type_bundled_radio.height()/2)) + # set some custom bridges + QtTest.QTest.mouseClick(self.gui.tor_bridges_use_custom_radio, QtCore.Qt.LeftButton, pos=QtCore.QPoint(2,self.gui.tor_bridges_use_custom_radio.height()/2)) + self.assertTrue(self.gui.tor_bridges_use_custom_radio.isChecked()) + self.assertTrue(self.gui.tor_bridges_use_custom_textbox.isVisible()) + self.gui.tor_bridges_use_custom_textbox.setPlainText('94.242.249.2:83 E25A95F1DADB739F0A83EB0223A37C02FD519306\n148.251.90.59:7510 019F727CA6DCA6CA5C90B55E477B7D87981E75BC\n93.80.47.217:41727 A6A0D497D98097FCFE91D639548EE9E34C15CDD3') + + # Test that the Settings Dialog can save the settings and close itself + QtTest.QTest.mouseClick(self.gui.save_button, QtCore.Qt.LeftButton) + self.assertFalse(self.gui.isVisible()) + + # Test our settings are reflected in the settings json + with open('/tmp/settings.json') as f: + data = json.load(f) + + self.assertTrue(data["public_mode"]) + self.assertTrue(data["shutdown_timeout"]) + self.assertTrue(data["use_legacy_v2_onions"]) + self.assertTrue(data["save_private_key"]) + self.assertTrue(data["use_stealth"]) + self.assertEqual(data["downloads_dir"], "/tmp/OnionShareSettingsTest") + self.assertFalse(data["receive_allow_receiver_shutdown"]) + self.assertFalse(data["close_after_first_download"]) + self.assertEqual(data["connection_type"], "bundled") + self.assertFalse(data["tor_bridges_use_obfs4"]) + self.assertEqual(data["tor_bridges_use_custom_bridges"], "Bridge 94.242.249.2:83 E25A95F1DADB739F0A83EB0223A37C02FD519306\nBridge 148.251.90.59:7510 019F727CA6DCA6CA5C90B55E477B7D87981E75BC\nBridge 93.80.47.217:41727 A6A0D497D98097FCFE91D639548EE9E34C15CDD3\n") + +if __name__ == "__main__": + unittest.main() diff --git a/tests/local_onionshare_share_mode_download_public_mode_test.py b/tests/local_onionshare_share_mode_download_public_mode_test.py index 3b4ad0e8..f1c29990 100644 --- a/tests/local_onionshare_share_mode_download_public_mode_test.py +++ b/tests/local_onionshare_share_mode_download_public_mode_test.py @@ -11,6 +11,10 @@ class LocalShareModePublicModeTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePublicModeTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_tests(True, False) diff --git a/tests/local_onionshare_share_mode_download_stay_open_test.py b/tests/local_onionshare_share_mode_download_stay_open_test.py index dfe7f56c..af02e841 100644 --- a/tests/local_onionshare_share_mode_download_stay_open_test.py +++ b/tests/local_onionshare_share_mode_download_stay_open_test.py @@ -11,6 +11,10 @@ class LocalShareModeStayOpenTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeStayOpenTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_tests(False, True) diff --git a/tests/local_onionshare_share_mode_download_test.py b/tests/local_onionshare_share_mode_download_test.py index 6b6b0bcc..53db0296 100644 --- a/tests/local_onionshare_share_mode_download_test.py +++ b/tests/local_onionshare_share_mode_download_test.py @@ -10,6 +10,10 @@ class LocalShareModeTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_tests(False, False) diff --git a/tests/local_onionshare_share_mode_large_download_test.py b/tests/local_onionshare_share_mode_large_download_test.py index 6fe77752..b8017b77 100644 --- a/tests/local_onionshare_share_mode_large_download_test.py +++ b/tests/local_onionshare_share_mode_large_download_test.py @@ -10,6 +10,10 @@ class LocalShareModeTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_large_file_tests(False, True) diff --git a/tests/local_onionshare_share_mode_slug_persistent_test.py b/tests/local_onionshare_share_mode_slug_persistent_test.py index a28f5a23..c273fbda 100644 --- a/tests/local_onionshare_share_mode_slug_persistent_test.py +++ b/tests/local_onionshare_share_mode_slug_persistent_test.py @@ -14,6 +14,10 @@ class LocalShareModePersistentSlugTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePersistentSlugTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_persistent_tests(False, True) diff --git a/tests/local_onionshare_share_mode_timer_test.py b/tests/local_onionshare_share_mode_timer_test.py index 9e3b0b5e..394dec21 100644 --- a/tests/local_onionshare_share_mode_timer_test.py +++ b/tests/local_onionshare_share_mode_timer_test.py @@ -12,6 +12,10 @@ class LocalShareModeTimerTest(unittest.TestCase, GuiShareTest): } cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTimerTest') + @classmethod + def tearDownClass(cls): + GuiShareTest.tear_down() + def test_gui(self): self.run_all_common_setup_tests() self.run_all_share_mode_timer_tests(False) diff --git a/tests/onionshare_790_cancel_on_second_share_test.py b/tests/onionshare_790_cancel_on_second_share_test.py index 327a8456..dce84f62 100644 --- a/tests/onionshare_790_cancel_on_second_share_test.py +++ b/tests/onionshare_790_cancel_on_second_share_test.py @@ -13,6 +13,10 @@ class ShareModeCancelSecondShareTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelSecondShareTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_receive_mode_upload_public_mode_test.py b/tests/onionshare_receive_mode_upload_public_mode_test.py index 56b49c81..048186c3 100644 --- a/tests/onionshare_receive_mode_upload_public_mode_test.py +++ b/tests/onionshare_receive_mode_upload_public_mode_test.py @@ -13,6 +13,10 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest): } cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest') + @classmethod + def tearDownClass(cls): + TorGuiReceiveTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_receive_mode_upload_test.py b/tests/onionshare_receive_mode_upload_test.py index 0fd8d5ed..d3965d59 100644 --- a/tests/onionshare_receive_mode_upload_test.py +++ b/tests/onionshare_receive_mode_upload_test.py @@ -12,6 +12,10 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest): } cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest') + @classmethod + def tearDownClass(cls): + TorGuiReceiveTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_cancel_share_test.py b/tests/onionshare_share_mode_cancel_share_test.py index 9770cc35..83a009a1 100644 --- a/tests/onionshare_share_mode_cancel_share_test.py +++ b/tests/onionshare_share_mode_cancel_share_test.py @@ -11,6 +11,10 @@ class ShareModeCancelTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_download_public_mode_test.py b/tests/onionshare_share_mode_download_public_mode_test.py index 8409720a..8c5740c5 100644 --- a/tests/onionshare_share_mode_download_public_mode_test.py +++ b/tests/onionshare_share_mode_download_public_mode_test.py @@ -12,6 +12,10 @@ class ShareModePublicModeTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePublicModeTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_download_stay_open_test.py b/tests/onionshare_share_mode_download_stay_open_test.py index c16f91e9..56ac924d 100644 --- a/tests/onionshare_share_mode_download_stay_open_test.py +++ b/tests/onionshare_share_mode_download_stay_open_test.py @@ -12,6 +12,10 @@ class ShareModeStayOpenTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStayOpenTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_download_test.py b/tests/onionshare_share_mode_download_test.py index 194328d9..125909d0 100644 --- a/tests/onionshare_share_mode_download_test.py +++ b/tests/onionshare_share_mode_download_test.py @@ -11,6 +11,10 @@ class ShareModeTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_persistent_test.py b/tests/onionshare_share_mode_persistent_test.py index 3c283943..3f103a1a 100644 --- a/tests/onionshare_share_mode_persistent_test.py +++ b/tests/onionshare_share_mode_persistent_test.py @@ -16,6 +16,10 @@ class ShareModePersistentSlugTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePersistentSlugTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_stealth_test.py b/tests/onionshare_share_mode_stealth_test.py index b414de1f..3096a8bc 100644 --- a/tests/onionshare_share_mode_stealth_test.py +++ b/tests/onionshare_share_mode_stealth_test.py @@ -13,6 +13,10 @@ class ShareModeStealthTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStealthTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests() diff --git a/tests/onionshare_share_mode_timer_test.py b/tests/onionshare_share_mode_timer_test.py index b53905d0..9e690ec7 100644 --- a/tests/onionshare_share_mode_timer_test.py +++ b/tests/onionshare_share_mode_timer_test.py @@ -13,6 +13,10 @@ class ShareModeTimerTest(unittest.TestCase, TorGuiShareTest): } cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTimerTest') + @classmethod + def tearDownClass(cls): + TorGuiShareTest.tear_down() + @pytest.mark.tor def test_gui(self): self.run_all_common_setup_tests()