mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-24 00:51:19 -04:00
Rename slugs to passwords in the tests
This commit is contained in:
parent
6d057c0078
commit
cec63daf3a
11 changed files with 65 additions and 67 deletions
|
@ -7,9 +7,9 @@ from .GuiBaseTest import GuiBaseTest
|
|||
|
||||
class GuiShareTest(GuiBaseTest):
|
||||
# Persistence tests
|
||||
def have_same_slug(self, slug):
|
||||
'''Test that we have the same slug'''
|
||||
self.assertEqual(self.gui.share_mode.server_status.web.slug, slug)
|
||||
def have_same_password(self, password):
|
||||
'''Test that we have the same password'''
|
||||
self.assertEqual(self.gui.share_mode.server_status.web.password, password)
|
||||
|
||||
# Share-specific tests
|
||||
|
||||
|
@ -17,7 +17,7 @@ class GuiShareTest(GuiBaseTest):
|
|||
'''Test that the number of items in the list is as expected'''
|
||||
self.assertEqual(self.gui.share_mode.server_status.file_selection.get_num_files(), num)
|
||||
|
||||
|
||||
|
||||
def deleting_all_files_hides_delete_button(self):
|
||||
'''Test that clicking on the file item shows the delete button. Test that deleting the only item in the list hides the delete button'''
|
||||
rect = self.gui.share_mode.server_status.file_selection.file_list.visualItemRect(self.gui.share_mode.server_status.file_selection.file_list.item(0))
|
||||
|
@ -35,14 +35,14 @@ class GuiShareTest(GuiBaseTest):
|
|||
# No more files, the delete button should be hidden
|
||||
self.assertFalse(self.gui.share_mode.server_status.file_selection.delete_button.isVisible())
|
||||
|
||||
|
||||
|
||||
def add_a_file_and_delete_using_its_delete_widget(self):
|
||||
'''Test that we can also delete a file by clicking on its [X] widget'''
|
||||
self.gui.share_mode.server_status.file_selection.file_list.add_file('/etc/hosts')
|
||||
QtTest.QTest.mouseClick(self.gui.share_mode.server_status.file_selection.file_list.item(0).item_button, QtCore.Qt.LeftButton)
|
||||
self.file_selection_widget_has_files(0)
|
||||
|
||||
|
||||
|
||||
def file_selection_widget_readd_files(self):
|
||||
'''Re-add some files to the list so we can share'''
|
||||
self.gui.share_mode.server_status.file_selection.file_list.add_file('/etc/hosts')
|
||||
|
@ -56,14 +56,14 @@ class GuiShareTest(GuiBaseTest):
|
|||
with open('/tmp/large_file', 'wb') as fout:
|
||||
fout.write(os.urandom(size))
|
||||
self.gui.share_mode.server_status.file_selection.file_list.add_file('/tmp/large_file')
|
||||
|
||||
|
||||
|
||||
def add_delete_buttons_hidden(self):
|
||||
'''Test that the add and delete buttons are hidden when the server starts'''
|
||||
self.assertFalse(self.gui.share_mode.server_status.file_selection.add_button.isVisible())
|
||||
self.assertFalse(self.gui.share_mode.server_status.file_selection.delete_button.isVisible())
|
||||
|
||||
|
||||
|
||||
def download_share(self, public_mode):
|
||||
'''Test that we can download the share'''
|
||||
s = socks.socksocket()
|
||||
|
@ -73,7 +73,7 @@ class GuiShareTest(GuiBaseTest):
|
|||
if public_mode:
|
||||
path = '/download'
|
||||
else:
|
||||
path = '{}/download'.format(self.gui.share_mode.web.slug)
|
||||
path = '{}/download'.format(self.gui.share_mode.web.password)
|
||||
|
||||
http_request = 'GET {} HTTP/1.0\r\n'.format(path)
|
||||
http_request += 'Host: 127.0.0.1\r\n'
|
||||
|
@ -130,7 +130,7 @@ class GuiShareTest(GuiBaseTest):
|
|||
self.add_a_file_and_delete_using_its_delete_widget()
|
||||
self.file_selection_widget_readd_files()
|
||||
|
||||
|
||||
|
||||
def run_all_share_mode_started_tests(self, public_mode, startup_time=2000):
|
||||
"""Tests in share mode after starting a share"""
|
||||
self.server_working_on_start_button_pressed(self.gui.share_mode)
|
||||
|
@ -139,12 +139,12 @@ class GuiShareTest(GuiBaseTest):
|
|||
self.settings_button_is_hidden()
|
||||
self.server_is_started(self.gui.share_mode, startup_time)
|
||||
self.web_server_is_running()
|
||||
self.have_a_slug(self.gui.share_mode, public_mode)
|
||||
self.have_a_password(self.gui.share_mode, public_mode)
|
||||
self.url_description_shown(self.gui.share_mode)
|
||||
self.have_copy_url_button(self.gui.share_mode, public_mode)
|
||||
self.server_status_indicator_says_started(self.gui.share_mode)
|
||||
|
||||
|
||||
|
||||
def run_all_share_mode_download_tests(self, public_mode, stay_open):
|
||||
"""Tests in share mode after downloading a share"""
|
||||
self.web_page(self.gui.share_mode, 'Total size', public_mode)
|
||||
|
@ -158,7 +158,7 @@ class GuiShareTest(GuiBaseTest):
|
|||
self.server_is_started(self.gui.share_mode)
|
||||
self.history_indicator(self.gui.share_mode, public_mode)
|
||||
|
||||
|
||||
|
||||
def run_all_share_mode_tests(self, public_mode, stay_open):
|
||||
"""End-to-end share tests"""
|
||||
self.run_all_share_mode_setup_tests()
|
||||
|
@ -178,12 +178,12 @@ class GuiShareTest(GuiBaseTest):
|
|||
|
||||
|
||||
def run_all_share_mode_persistent_tests(self, public_mode, stay_open):
|
||||
"""Same as end-to-end share tests but also test the slug is the same on multiple shared"""
|
||||
"""Same as end-to-end share tests but also test the password is the same on multiple shared"""
|
||||
self.run_all_share_mode_setup_tests()
|
||||
self.run_all_share_mode_started_tests(public_mode)
|
||||
slug = self.gui.share_mode.server_status.web.slug
|
||||
password = self.gui.share_mode.server_status.web.password
|
||||
self.run_all_share_mode_download_tests(public_mode, stay_open)
|
||||
self.have_same_slug(slug)
|
||||
self.have_same_password(password)
|
||||
|
||||
|
||||
def run_all_share_mode_timer_tests(self, public_mode):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue