summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2019-09-09 12:19:39 +1000
committerMiguel Jacq <mig@mig5.net>2019-09-09 12:19:39 +1000
commit8e238ab2d66c336029a54f54f6d989b46964d448 (patch)
tree81a0bb0c7db6265e23e6308f7a34b6d37e3c5d1d
parent26c9256679c817ce608174ef980815e63dc4f995 (diff)
downloadonionshare-8e238ab2d66c336029a54f54f6d989b46964d448.tar.gz
onionshare-8e238ab2d66c336029a54f54f6d989b46964d448.zip
Fix tests in Receive Mode that actually do increment the history item widget count where they didn't previously (due to an additional GET that follows the 302 redirect of a POST request on upload)
-rw-r--r--tests/GuiBaseTest.py4
-rw-r--r--tests/GuiReceiveTest.py30
2 files changed, 4 insertions, 30 deletions
diff --git a/tests/GuiBaseTest.py b/tests/GuiBaseTest.py
index 9a69619b..4f087431 100644
--- a/tests/GuiBaseTest.py
+++ b/tests/GuiBaseTest.py
@@ -116,7 +116,7 @@ class GuiBaseTest(object):
self.assertEqual(mode.history.isVisible(), not currently_visible)
- def history_indicator(self, mode, public_mode):
+ def history_indicator(self, mode, public_mode, indicator_count="1"):
'''Test that we can make sure the history is toggled off, do an action, and the indiciator works'''
# Make sure history is toggled off
if mode.history.isVisible():
@@ -147,7 +147,7 @@ class GuiBaseTest(object):
# Indicator should be visible, have a value of "1"
self.assertTrue(mode.toggle_history.indicator_label.isVisible())
- self.assertEqual(mode.toggle_history.indicator_label.text(), "1")
+ self.assertEqual(mode.toggle_history.indicator_label.text(), indicator_count)
# Toggle history back on, indicator should be hidden again
QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton)
diff --git a/tests/GuiReceiveTest.py b/tests/GuiReceiveTest.py
index c4bfa884..ef420ec2 100644
--- a/tests/GuiReceiveTest.py
+++ b/tests/GuiReceiveTest.py
@@ -66,31 +66,6 @@ class GuiReceiveTest(GuiBaseTest):
r = requests.get('http://127.0.0.1:{}/close'.format(self.gui.app.port))
self.assertEqual(r.status_code, 401)
- def uploading_zero_files_shouldnt_change_ui(self, mode, public_mode):
- '''If you submit the receive mode form without selecting any files, the UI shouldn't get updated'''
- url = 'http://127.0.0.1:{}/upload'.format(self.gui.app.port)
-
- # What were the counts before submitting the form?
- before_in_progress_count = mode.history.in_progress_count
- before_completed_count = mode.history.completed_count
- before_number_of_history_items = len(mode.history.item_list.items)
-
- # Click submit without including any files a few times
- if public_mode:
- r = requests.post(url, files={})
- r = requests.post(url, files={})
- r = requests.post(url, files={})
- else:
- auth = requests.auth.HTTPBasicAuth('onionshare', mode.web.password)
- r = requests.post(url, files={}, auth=auth)
- r = requests.post(url, files={}, auth=auth)
- r = requests.post(url, files={}, auth=auth)
-
- # The counts shouldn't change
- self.assertEqual(mode.history.in_progress_count, before_in_progress_count)
- self.assertEqual(mode.history.completed_count, before_completed_count)
- self.assertEqual(len(mode.history.item_list.items), before_number_of_history_items)
-
# 'Grouped' tests follow from here
def run_all_receive_mode_setup_tests(self, public_mode):
@@ -127,14 +102,13 @@ class GuiReceiveTest(GuiBaseTest):
# Test uploading the same file twice at the same time, and make sure no collisions
self.upload_file(public_mode, '/tmp/test.txt', 'test.txt', True)
self.counter_incremented(self.gui.receive_mode, 6)
- self.uploading_zero_files_shouldnt_change_ui(self.gui.receive_mode, public_mode)
- self.history_indicator(self.gui.receive_mode, public_mode)
+ self.history_indicator(self.gui.receive_mode, public_mode, "2")
self.server_is_stopped(self.gui.receive_mode, False)
self.web_server_is_stopped()
self.server_status_indicator_says_closed(self.gui.receive_mode, False)
self.server_working_on_start_button_pressed(self.gui.receive_mode)
self.server_is_started(self.gui.receive_mode)
- self.history_indicator(self.gui.receive_mode, public_mode)
+ self.history_indicator(self.gui.receive_mode, public_mode, "2")
def run_all_receive_mode_unwritable_dir_tests(self, public_mode):
'''Attempt to upload (unwritable) files in receive mode and stop the share'''