mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-05 07:55:23 -04:00
Added test_public_mode
This commit is contained in:
parent
d676fb7de5
commit
e65d13fb83
2 changed files with 20 additions and 12 deletions
|
@ -114,6 +114,8 @@ class GuiBaseTest(unittest.TestCase):
|
||||||
|
|
||||||
def close_all_tabs(self):
|
def close_all_tabs(self):
|
||||||
for _ in range(self.gui.tabs.count()):
|
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()
|
self.gui.tabs.tabBar().tabButton(0, QtWidgets.QTabBar.RightSide).click()
|
||||||
|
|
||||||
def gui_loaded(self):
|
def gui_loaded(self):
|
||||||
|
@ -307,16 +309,6 @@ class GuiBaseTest(unittest.TestCase):
|
||||||
"""Test that the counter has incremented"""
|
"""Test that the counter has incremented"""
|
||||||
self.assertEqual(tab.get_mode().history.completed_count, count)
|
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):
|
def server_is_stopped(self, tab):
|
||||||
"""Test that the server stops when we click Stop"""
|
"""Test that the server stops when we click Stop"""
|
||||||
if (
|
if (
|
||||||
|
@ -348,7 +340,7 @@ class GuiBaseTest(unittest.TestCase):
|
||||||
strings._("gui_status_indicator_receive_stopped"),
|
strings._("gui_status_indicator_receive_stopped"),
|
||||||
)
|
)
|
||||||
if type(tab.get_mode()) == ShareMode:
|
if type(tab.get_mode()) == ShareMode:
|
||||||
if tab.settings.get("share", "autostop_sharing"):
|
if not tab.settings.get("share", "autostop_sharing"):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
tab.get_mode().server_status_label.text(),
|
tab.get_mode().server_status_label.text(),
|
||||||
strings._("gui_status_indicator_share_stopped"),
|
strings._("gui_status_indicator_share_stopped"),
|
||||||
|
|
|
@ -114,6 +114,8 @@ class TestShare(GuiBaseTest):
|
||||||
QtTest.QTest.qWait(50)
|
QtTest.QTest.qWait(50)
|
||||||
self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8"))
|
self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8"))
|
||||||
|
|
||||||
|
QtTest.QTest.qWait(500)
|
||||||
|
|
||||||
def individual_file_is_viewable_or_not(self, tab):
|
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
|
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.scheduled_service_started(tab, 2200)
|
||||||
self.web_server_is_running(tab)
|
self.web_server_is_running(tab)
|
||||||
|
|
||||||
self.stop_running_server(tab)
|
|
||||||
self.close_all_tabs()
|
self.close_all_tabs()
|
||||||
|
|
||||||
@pytest.mark.gui
|
@pytest.mark.gui
|
||||||
|
@ -455,3 +456,18 @@ class TestShare(GuiBaseTest):
|
||||||
|
|
||||||
self.run_all_common_setup_tests()
|
self.run_all_common_setup_tests()
|
||||||
self.run_all_clear_all_button_tests(tab)
|
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…
Add table
Add a link
Reference in a new issue