Added test_upload

This commit is contained in:
Micah Lee 2019-11-10 11:33:59 -08:00
parent 329339dab8
commit 4dde85e4f6
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 20 additions and 3 deletions

View File

@ -50,6 +50,11 @@ class GuiBaseTest(unittest.TestCase):
with open(cls.tmpfile_test, "w") as file:
file.write("onionshare")
# A file called "test2.txt"
cls.tmpfile_test2 = os.path.join(cls.tmpdir.name, "test2.txt")
with open(cls.tmpfile_test2, "w") as file:
file.write("onionshare2")
# A large file
size = 1024 * 1024 * 155
cls.tmpfile_large = os.path.join(cls.tmpdir.name, "large_file")

View File

@ -121,15 +121,15 @@ class TestReceive(GuiBaseTest):
self.counter_incremented(tab, 1)
self.upload_file(tab, self.tmpfile_test, "test.txt")
self.counter_incremented(tab, 2)
self.upload_file(tab, "/tmp/testdir/test", "test")
self.upload_file(tab, self.tmpfile_test2, "test2.txt")
self.counter_incremented(tab, 3)
self.upload_file(tab, "/tmp/testdir/test", "test")
self.upload_file(tab, self.tmpfile_test2, "test2.txt")
self.counter_incremented(tab, 4)
# Test uploading the same file twice at the same time, and make sure no collisions
self.upload_file(tab, self.tmpfile_test, "test.txt", True)
self.counter_incremented(tab, 6)
self.history_indicator(tab, "2")
self.server_is_stopped(tab, False)
self.server_is_stopped(tab)
self.web_server_is_stopped(tab)
self.server_status_indicator_says_closed(tab)
self.server_working_on_start_button_pressed(tab)
@ -186,3 +186,15 @@ class TestReceive(GuiBaseTest):
self.web_server_is_stopped(tab)
self.close_all_tabs()
@pytest.mark.gui
def test_upload(self):
"""
Test uploading files
"""
tab = self.new_receive_tab()
self.run_all_common_setup_tests()
self.run_all_receive_mode_tests(tab)
self.close_all_tabs()