mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-27 23:07:14 -05:00
Start adding test_autostart_timer
This commit is contained in:
parent
6c89ce2f28
commit
29ebdd850e
@ -109,6 +109,10 @@ class GuiBaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
|
def close_all_tabs(self):
|
||||||
|
for _ in range(self.gui.tabs.count()):
|
||||||
|
self.gui.tabs.tabBar().tabButton(0, QtWidgets.QTabBar.RightSide).click()
|
||||||
|
|
||||||
def gui_loaded(self):
|
def gui_loaded(self):
|
||||||
"""Test that the GUI actually is shown"""
|
"""Test that the GUI actually is shown"""
|
||||||
self.assertTrue(self.gui.show)
|
self.assertTrue(self.gui.show)
|
||||||
|
@ -200,7 +200,7 @@ class TestShare(GuiBaseTest):
|
|||||||
schedule,
|
schedule,
|
||||||
)
|
)
|
||||||
|
|
||||||
def autostart_timer_widget_hidden(self, tab, mode):
|
def autostart_timer_widget_hidden(self, tab):
|
||||||
"""Test that the auto-start timer widget is hidden when share has started"""
|
"""Test that the auto-start timer widget is hidden when share has started"""
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
tab.get_mode().mode_settings_widget.autostart_timer_widget.isVisible()
|
tab.get_mode().mode_settings_widget.autostart_timer_widget.isVisible()
|
||||||
@ -336,17 +336,6 @@ class TestShare(GuiBaseTest):
|
|||||||
self.server_timed_out(tab, 10000)
|
self.server_timed_out(tab, 10000)
|
||||||
self.web_server_is_stopped(tab)
|
self.web_server_is_stopped(tab)
|
||||||
|
|
||||||
def run_all_share_mode_autostart_timer_tests(self, tab):
|
|
||||||
"""Auto-start timer tests in share mode"""
|
|
||||||
self.run_all_share_mode_setup_tests(tab)
|
|
||||||
self.set_autostart_timer(tab, 5)
|
|
||||||
self.server_working_on_start_button_pressed(tab)
|
|
||||||
self.autostart_timer_widget_hidden(tab)
|
|
||||||
self.server_status_indicator_says_scheduled(tab)
|
|
||||||
self.web_server_is_stopped(tab)
|
|
||||||
self.scheduled_service_started(tab, 7000)
|
|
||||||
self.web_server_is_running(tab)
|
|
||||||
|
|
||||||
def run_all_share_mode_unreadable_file_tests(self, tab):
|
def run_all_share_mode_unreadable_file_tests(self, tab):
|
||||||
"""Attempt to share an unreadable file"""
|
"""Attempt to share an unreadable file"""
|
||||||
self.run_all_share_mode_setup_tests(tab)
|
self.run_all_share_mode_setup_tests(tab)
|
||||||
@ -360,6 +349,9 @@ class TestShare(GuiBaseTest):
|
|||||||
|
|
||||||
@pytest.mark.gui
|
@pytest.mark.gui
|
||||||
def test_autostart_and_autostop_timer_mismatch(self):
|
def test_autostart_and_autostop_timer_mismatch(self):
|
||||||
|
"""
|
||||||
|
If autostart timer is after autostop timer, a warning should be thrown
|
||||||
|
"""
|
||||||
tab = self.new_share_tab()
|
tab = self.new_share_tab()
|
||||||
|
|
||||||
def accept_dialog():
|
def accept_dialog():
|
||||||
@ -379,3 +371,24 @@ class TestShare(GuiBaseTest):
|
|||||||
QtCore.QTimer.singleShot(200, accept_dialog)
|
QtCore.QTimer.singleShot(200, accept_dialog)
|
||||||
tab.get_mode().server_status.server_button.click()
|
tab.get_mode().server_status.server_button.click()
|
||||||
self.server_is_stopped(tab)
|
self.server_is_stopped(tab)
|
||||||
|
|
||||||
|
self.close_all_tabs()
|
||||||
|
|
||||||
|
@pytest.mark.gui
|
||||||
|
def test_autostart_timer(self):
|
||||||
|
"""
|
||||||
|
Autostart timer should automatically start
|
||||||
|
"""
|
||||||
|
tab = self.new_share_tab()
|
||||||
|
self.run_all_common_setup_tests()
|
||||||
|
|
||||||
|
self.run_all_share_mode_setup_tests(tab)
|
||||||
|
self.set_autostart_timer(tab, 5)
|
||||||
|
self.server_working_on_start_button_pressed(tab)
|
||||||
|
self.autostart_timer_widget_hidden(tab)
|
||||||
|
self.server_status_indicator_says_scheduled(tab)
|
||||||
|
self.web_server_is_stopped(tab)
|
||||||
|
self.scheduled_service_started(tab, 7000)
|
||||||
|
self.web_server_is_running(tab)
|
||||||
|
|
||||||
|
self.close_all_tabs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user