mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 07:49:48 -05:00
Added test_public_mode
This commit is contained in:
parent
1e98ccb696
commit
eff5fb1c4a
@ -114,6 +114,8 @@ class GuiBaseTest(unittest.TestCase):
|
||||
|
||||
def close_all_tabs(self):
|
||||
for _ in range(self.gui.tabs.count()):
|
||||
tab = self.gui.tabs.widget(0)
|
||||
QtCore.QTimer.singleShot(0, tab.close_dialog.accept_button.click)
|
||||
self.gui.tabs.tabBar().tabButton(0, QtWidgets.QTabBar.RightSide).click()
|
||||
|
||||
def gui_loaded(self):
|
||||
@ -307,16 +309,6 @@ class GuiBaseTest(unittest.TestCase):
|
||||
"""Test that the counter has incremented"""
|
||||
self.assertEqual(tab.get_mode().history.completed_count, count)
|
||||
|
||||
def stop_running_server(self, tab):
|
||||
"""Stop a server that's running"""
|
||||
self.assertNotEqual(tab.get_mode().server_status.status, 0)
|
||||
|
||||
tab.get_mode().server_status.server_button.click()
|
||||
QtTest.QTest.qWait(200)
|
||||
|
||||
self.server_is_stopped(tab)
|
||||
self.web_server_is_stopped(tab)
|
||||
|
||||
def server_is_stopped(self, tab):
|
||||
"""Test that the server stops when we click Stop"""
|
||||
if (
|
||||
@ -348,7 +340,7 @@ class GuiBaseTest(unittest.TestCase):
|
||||
strings._("gui_status_indicator_receive_stopped"),
|
||||
)
|
||||
if type(tab.get_mode()) == ShareMode:
|
||||
if tab.settings.get("share", "autostop_sharing"):
|
||||
if not tab.settings.get("share", "autostop_sharing"):
|
||||
self.assertEqual(
|
||||
tab.get_mode().server_status_label.text(),
|
||||
strings._("gui_status_indicator_share_stopped"),
|
||||
|
@ -114,6 +114,8 @@ class TestShare(GuiBaseTest):
|
||||
QtTest.QTest.qWait(50)
|
||||
self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8"))
|
||||
|
||||
QtTest.QTest.qWait(500)
|
||||
|
||||
def individual_file_is_viewable_or_not(self, tab):
|
||||
"""
|
||||
Test that an individual file is viewable (when in autostop_sharing is false) or that it
|
||||
@ -402,7 +404,6 @@ class TestShare(GuiBaseTest):
|
||||
self.scheduled_service_started(tab, 2200)
|
||||
self.web_server_is_running(tab)
|
||||
|
||||
self.stop_running_server(tab)
|
||||
self.close_all_tabs()
|
||||
|
||||
@pytest.mark.gui
|
||||
@ -455,3 +456,18 @@ class TestShare(GuiBaseTest):
|
||||
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_clear_all_button_tests(tab)
|
||||
|
||||
self.close_all_tabs()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_public_mode(self):
|
||||
"""
|
||||
Public mode shouldn't have a password
|
||||
"""
|
||||
tab = self.new_share_tab()
|
||||
tab.get_mode().mode_settings_widget.public_checkbox.click()
|
||||
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(tab)
|
||||
|
||||
self.close_all_tabs()
|
||||
|
Loading…
Reference in New Issue
Block a user