mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Extend coverage of website mode tests
This commit is contained in:
parent
458a0fb1d0
commit
9ae98eb7cb
@ -202,6 +202,9 @@ class GuiBaseTest(object):
|
||||
else:
|
||||
self.assertIsNone(mode.server_status.web.password, r'(\w+)-(\w+)')
|
||||
|
||||
def add_button_visible(self, mode):
|
||||
'''Test that the add button should be visible'''
|
||||
self.assertTrue(mode.server_status.file_selection.add_button.isVisible())
|
||||
|
||||
def url_description_shown(self, mode):
|
||||
'''Test that the URL label is showing'''
|
||||
@ -253,7 +256,7 @@ class GuiBaseTest(object):
|
||||
|
||||
def server_is_stopped(self, mode, stay_open):
|
||||
'''Test that the server stops when we click Stop'''
|
||||
if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open):
|
||||
if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open) or (type(mode) == WebsiteMode):
|
||||
QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton)
|
||||
self.assertEqual(mode.server_status.status, 0)
|
||||
|
||||
|
@ -130,11 +130,6 @@ class GuiShareTest(GuiBaseTest):
|
||||
self.web_server_is_stopped()
|
||||
|
||||
|
||||
def add_button_visible(self):
|
||||
'''Test that the add button should be visible'''
|
||||
self.assertTrue(self.gui.share_mode.server_status.file_selection.add_button.isVisible())
|
||||
|
||||
|
||||
# 'Grouped' tests follow from here
|
||||
|
||||
def run_all_share_mode_setup_tests(self):
|
||||
@ -171,7 +166,7 @@ class GuiShareTest(GuiBaseTest):
|
||||
self.server_is_stopped(self.gui.share_mode, stay_open)
|
||||
self.web_server_is_stopped()
|
||||
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
|
||||
self.add_button_visible()
|
||||
self.add_button_visible(self.gui.share_mode)
|
||||
self.server_working_on_start_button_pressed(self.gui.share_mode)
|
||||
self.server_is_started(self.gui.share_mode)
|
||||
self.history_indicator(self.gui.share_mode, public_mode)
|
||||
@ -184,7 +179,7 @@ class GuiShareTest(GuiBaseTest):
|
||||
self.server_is_stopped(self.gui.share_mode, stay_open)
|
||||
self.web_server_is_stopped()
|
||||
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
|
||||
self.add_button_visible()
|
||||
self.add_button_visible(self.gui.share_mode)
|
||||
self.server_working_on_start_button_pressed(self.gui.share_mode)
|
||||
self.server_is_started(self.gui.share_mode)
|
||||
self.history_indicator(self.gui.share_mode, public_mode)
|
||||
|
@ -54,7 +54,6 @@ class GuiWebsiteTest(GuiShareTest):
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def view_website(self, public_mode):
|
||||
'''Test that we can download the share'''
|
||||
url = "http://127.0.0.1:{}/".format(self.gui.app.port)
|
||||
@ -88,10 +87,14 @@ class GuiWebsiteTest(GuiShareTest):
|
||||
self.server_status_indicator_says_started(self.gui.website_mode)
|
||||
|
||||
|
||||
def run_all_website_mode_download_tests(self, public_mode, stay_open):
|
||||
def run_all_website_mode_download_tests(self, public_mode):
|
||||
"""Tests in website mode after viewing the site"""
|
||||
self.run_all_website_mode_setup_tests()
|
||||
self.run_all_website_mode_started_tests(public_mode, startup_time=2000)
|
||||
self.view_website(public_mode)
|
||||
self.history_widgets_present(self.gui.website_mode)
|
||||
self.server_is_stopped(self.gui.website_mode, False)
|
||||
self.web_server_is_stopped()
|
||||
self.server_status_indicator_says_closed(self.gui.website_mode, False)
|
||||
self.add_button_visible(self.gui.website_mode)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class TorGuiShareTest(TorGuiBaseTest, GuiShareTest):
|
||||
self.server_is_stopped(self.gui.share_mode, stay_open)
|
||||
self.web_server_is_stopped()
|
||||
self.server_status_indicator_says_closed(self.gui.share_mode, stay_open)
|
||||
self.add_button_visible()
|
||||
self.add_button_visible(self.gui.share_mode)
|
||||
self.server_working_on_start_button_pressed(self.gui.share_mode)
|
||||
self.server_is_started(self.gui.share_mode, startup_time=45000)
|
||||
self.history_indicator(self.gui.share_mode, public_mode)
|
||||
|
@ -19,7 +19,7 @@ class LocalWebsiteModeTest(unittest.TestCase, GuiWebsiteTest):
|
||||
@pytest.mark.skipif(pytest.__version__ < '2.9', reason="requires newer pytest")
|
||||
def test_gui(self):
|
||||
#self.run_all_common_setup_tests()
|
||||
self.run_all_website_mode_download_tests(False, False)
|
||||
self.run_all_website_mode_download_tests(False)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user